import java.util.Scanner;

public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    }
    private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    }
    private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    }
} Main private static Scanner sc=new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    } main {
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    } 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 print(a) print a for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        } {
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        } int t=a[i]; t a[i] a i int j=i-1; j i-1 i 1 while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            } j>=0&&a[j]>t j>=0 j 0 a[j]>t a[j] a j t {
                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]=t a[j+1] a j+1 j 1 t print(a) print a String[] args args private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    } print {
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    } for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" "); int i=0; int i=0; i 0 i<=a.length-2 i a.length-2 a.length a a.length 2 i++ i++ i System.out.print(a[i]+" "); System.out.print(a[i]+" ") System.out.print System.out System System.out a[i]+" " a[i] a i " " System.out.println(a[a.length-1]) System.out.println System.out System System.out a[a.length-1] a a.length-1 a.length a a.length 1 int[] a a public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    }
    private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    }
} public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    }
    private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    }
} Main
import java.util.Scanner;

public class Main {
    private static Scanner sc=new Scanner(System.in);
    public static void main(String[] args){
        int n=sc.nextInt();
        int[] a=new int[n];
        for(int i=0;i<n;i++) a[i]=sc.nextInt();
        print(a);
        for(int i=1;i<n;i++){
            int t=a[i];
            int j=i-1;
            while(j>=0&&a[j]>t){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=t;
            print(a);
        }
    }
    private static void print(int[] a){
        for(int i=0;i<=a.length-2;i++) System.out.print(a[i]+" ");
        System.out.println(a[a.length-1]);
    }
}