import java.util.Scanner;

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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    }
}
 import java.util.Scanner; Scanner 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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    }
} 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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\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 < a.length; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        } int m = 0; int m = 0; m 0 m < a.length - 1 m a.length - 1 a.length a a.length 1 m++ m++ m {
            System.out.print(a[m] + " ");
        } {
            System.out.print(a[m] + " ");
        } System.out.print(a[m] + " ") System.out.print System.out System System.out a[m] + " " a[m] a m " " System.out.print(a[a.length - 1] + "\n") System.out.print System.out System System.out a[a.length - 1] + "\n" a[a.length - 1] a a.length - 1 a.length a a.length 1 "\n" for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        } int i = 1; int i = 1; i 1 i < a.length i a.length a a.length 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        } {

            int key = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = key;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        } 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 for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            } int m = 0; int m = 0; m 0 m < a.length - 1 m a.length - 1 a.length a a.length 1 m++ m++ m {
                System.out.print(a[m] + " ");
            } {
                System.out.print(a[m] + " ");
            } System.out.print(a[m] + " ") System.out.print System.out System System.out a[m] + " " a[m] a m " " System.out.print(a[a.length - 1] + "\n") System.out.print System.out System System.out a[a.length - 1] + "\n" a[a.length - 1] a a.length - 1 a.length a a.length 1 "\n" String[] args args 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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    }
} 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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    }
} Main
import java.util.Scanner;

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 < a.length; i++) {
            a[i] = sc.nextInt();
        }
        for (int m = 0; m < a.length - 1; m++) {
            System.out.print(a[m] + " ");
        }
        System.out.print(a[a.length - 1] + "\n");
        for (int i = 1; i < a.length; 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;

            for (int m = 0; m < a.length - 1; m++) {
                System.out.print(a[m] + " ");
            }
            System.out.print(a[a.length - 1] + "\n");

        }
    }
}

