import java.util.*;

class Main{
        static void printArray(int[] A){
                for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        }
        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();
                }

                for(int i=1; i<N; i++){
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                }
                printArray(A);
        }
} import java.util.*; util.* java class Main{
        static void printArray(int[] A){
                for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        }
        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();
                }

                for(int i=1; i<N; i++){
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                }
                printArray(A);
        }
} Main static void printArray(int[] A){
                for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        } printArray {
                for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        } for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                } int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                } {
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                } System.out.print(A[i]) System.out.print System.out System System.out A[i] A i if(i != A.length-1)
                                System.out.print(" "); i != A.length-1 i A.length-1 A.length A A.length 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] A A 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();
                }

                for(int i=1; i<N; i++){
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                }
                printArray(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();
                }

                for(int i=1; i<N; i++){
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                }
                printArray(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 for(int i=1; i<N; i++){
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                } int i=1; int i=1; i 1 i<N i N i++ i++ i {
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                } {
                        int key = A[i];
                        int j = i-1;
                        printArray(A);
                        while(j>=0 && A[j]>key){
                                A[j+1] = A[j];
                                j--;
                        }
                        A[j+1] = key;
                } int key = A[i]; key A[i] A i int j = i-1; j i-1 i 1 printArray(A) printArray A 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) printArray A String[] args args
import java.util.*;

class Main{
        static void printArray(int[] A){
                for(int i=0; i<A.length; i++){
                        System.out.print(A[i]);
                        if(i != A.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        }
        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();
                }

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