import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    }

    private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    }

    private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = scanner.nextInt();
        } {
            a[i] = scanner.nextInt();
        } a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner printArray(n, a) printArray n a for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        } {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        } int key = a[i]; key a[i] a i int 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(n, a) printArray n a String[] args args private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    } printArray {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    } for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        } {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        } if (k != 0) {
                System.out.print(" ");
            } k != 0 k 0 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.print(a[k]) System.out.print System.out System System.out a[k] a k System.out.println() System.out.println System.out System System.out int n n int[] a a public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    }

    private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    }

} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    }

    private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    }

} Main
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        printArray(n, a);
        for (int i = 1; i < n; i++) {
            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;
            printArray(n, a);
        }
    }

    private static void printArray(int n, int[] a) {
        for (int k = 0; k < n; k++) {
            if (k != 0) {
                System.out.print(" ");
            }
            System.out.print(a[k]);
        }
        System.out.println();
    }

}