import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }

        int key;
        int i, j, k;
        String output;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        }
    }

    public static void printArray (int[] array, int length) {
        String output = "";
        for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        }
        System.out.println(output);
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }

        int key;
        int i, j, k;
        String output;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        }
    }

    public static void printArray (int[] array, int length) {
        String output = "";
        for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        }
        System.out.println(output);
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }

        int key;
        int i, j, k;
        String output;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }

        int key;
        int i, j, k;
        String output;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] elements = br.readLine().split(" "); elements br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = Integer.parseInt(elements[i]);
        } {
            A[i] = Integer.parseInt(elements[i]);
        } A[i] = Integer.parseInt(elements[i]) A[i] A i Integer.parseInt(elements[i]) Integer.parseInt Integer elements[i] elements i int key; key int i i j j k; k String output; output printArray(A, N) printArray A N for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        } i = 1; i = 1 i 1 i < N i N i++ i++ i {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        } {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        } key = A[i] key A[i] A i j = i - 1 j i - 1 i 1 while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            } j >= 0 && A[j] > key j >= 0 j 0 A[j] > key A[j] A j key {
                A[j+1] = A[j];
                j--;
            } A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j-- j A[j+1] = key A[j+1] A j+1 j 1 key printArray(A, N) printArray A N String[] args args public static void printArray (int[] array, int length) {
        String output = "";
        for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        }
        System.out.println(output);
    } printArray {
        String output = "";
        for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        }
        System.out.println(output);
    } String output = ""; output "" for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        } int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        } {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        } output += array[i] output array[i] array i if (i != length-1) {
                output += " ";
            } i != length-1 i length-1 length 1 {
                output += " ";
            } output += " " output " " System.out.println(output) System.out.println System.out System System.out output int[] array array int length length
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }

        int key;
        int i, j, k;
        String output;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;

            printArray(A, N);
        }
    }

    public static void printArray (int[] array, int length) {
        String output = "";
        for (int i = 0; i < length; i++) {
            output += array[i];
            if (i != length-1) {
                output += " ";
            }
        }
        System.out.println(output);
    }
}