import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    } main {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++)
            A[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < N i N i++ i++ i A[i] = sc.nextInt(); A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc insertionSort(A, N) insertionSort A N String[] args args private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    } insertionSort {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    } p(a) p a for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        } {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        } int v = a[i]; v a[i] a i int j = i - 1; j i - 1 i 1 while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            } j >= 0 && a[j] > v j >= 0 j 0 a[j] > v a[j] a j v {
                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] = v a[j + 1] a j + 1 j 1 v p(a) p a int[] a a int n n private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    } p {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    } for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]); int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i System.out.print((i == 0) ? a[i] : " " + a[i]); System.out.print((i == 0) ? a[i] : " " + a[i]) System.out.print System.out System System.out (i == 0) ? a[i] : " " + a[i] (i == 0) i 0 a[i] a i " " + a[i] " " a[i] a i System.out.println() System.out.println System.out System System.out int[] a a public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] A = new int[N];

        for (int i = 0; i < N; i++)
            A[i] = sc.nextInt();

        insertionSort(A, N);
    }
    private static void insertionSort(int[] a, int n) {
        p(a);
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            p(a);
        }
    }
    private static void p(int[] a) {
        for (int i = 0; i < a.length; i++)
            System.out.print((i == 0) ? a[i] : " " + a[i]);
        System.out.println();
    }
}

