import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.System;

class Main {
    public static void main(String[] a) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(r.readLine());
        String[] str = r.readLine().split(" ");

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int v, j;
        StringBuilder s;
        show(n, arr);
        for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        }
    }

    private static void show(int n, int[] arr) {
        StringBuilder s;// ?????? => String
        s = new StringBuilder();
        for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        }
        System.out.println(s);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.lang.System; System java.lang class Main {
    public static void main(String[] a) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(r.readLine());
        String[] str = r.readLine().split(" ");

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int v, j;
        StringBuilder s;
        show(n, arr);
        for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        }
    }

    private static void show(int n, int[] arr) {
        StringBuilder s;// ?????? => String
        s = new StringBuilder();
        for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        }
        System.out.println(s);
    }
} Main public static void main(String[] a) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(r.readLine());
        String[] str = r.readLine().split(" ");

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int v, j;
        StringBuilder s;
        show(n, arr);
        for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        }
    } main {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(r.readLine());
        String[] str = r.readLine().split(" ");

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int v, j;
        StringBuilder s;
        show(n, arr);
        for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        }
    } BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(r.readLine()); n Integer.parseInt(r.readLine()) Integer.parseInt Integer r.readLine() r.readLine r String[] str = r.readLine().split(" "); str r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = Integer.parseInt(str[i]);
        } {
            arr[i] = Integer.parseInt(str[i]);
        } arr[i] = Integer.parseInt(str[i]) arr[i] arr i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int v v j; j StringBuilder s; s show(n, arr) show n arr for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        } {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        } v = arr[i] v arr[i] arr i j = i - 1 j i - 1 i 1 while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            } j >= 0 && arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v {
                arr[j+1] = arr[j];
                j--;
            } arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j-- j arr[j+1] = v arr[j+1] arr j+1 j 1 v show(n, arr) show n arr String[] a a private static void show(int n, int[] arr) {
        StringBuilder s;// ?????? => String
        s = new StringBuilder();
        for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        }
        System.out.println(s);
    } show {
        StringBuilder s;// ?????? => String
        s = new StringBuilder();
        for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        }
        System.out.println(s);
    } StringBuilder s; s s = new StringBuilder() s new StringBuilder() for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        } {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        } s.append(arr[k]) s.append s arr[k] arr k if (k != n -1) { s.append(" "); } k != n -1 k n -1 n 1 { s.append(" "); } s.append(" ") s.append s " " System.out.println(s) System.out.println System.out System System.out s int n n int[] arr arr
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.System;

class Main {
    public static void main(String[] a) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(r.readLine());
        String[] str = r.readLine().split(" ");

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }

        int v, j;
        StringBuilder s;
        show(n, arr);
        for (int i = 1; i < n; i++) {
            v = arr[i];

            j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            show(n, arr);
        }
    }

    private static void show(int n, int[] arr) {
        StringBuilder s;// ?????? => String
        s = new StringBuilder();
        for (int k = 0; k < n; k++) {
            s.append(arr[k]);
            if (k != n -1) { s.append(" "); }
        }
        System.out.println(s);
    }
}