
import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    }
} 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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    }
} 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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a[] = new int[N];
        for(int I=0;I<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    } 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<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] = sc.nextInt() a[I] a I sc.nextInt() sc.nextInt sc for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        } int ii=0; int ii=0; ii 0 ii<N-1 ii N-1 N 1 ii++ ii++ ii {
            System.out.print(a[ii]+" ");
        } {
            System.out.print(a[ii]+" ");
        } System.out.print(a[ii]+" ") System.out.print System.out System System.out a[ii]+" " a[ii] a ii " " System.out.println(a[N-1]) System.out.println System.out System System.out a[N-1] a N-1 N 1 for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        } int i=1; int i=1; i 1 i<N i N i++ i++ i {
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        } {
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        } int v = a[i] v a[i] a i j=i-1; j i-1 i 1 while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            } j>=0 && a[j]>v j>=0 j 0 a[j]>v a[j] a j v {
                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] = v a[j+1] a j+1 j 1 v for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            } int ii=0; int ii=0; ii 0 ii<N-1 ii N-1 N 1 ii++ ii++ ii {
                System.out.print(a[ii]+" ");
            } {
                System.out.print(a[ii]+" ");
            } System.out.print(a[ii]+" ") System.out.print System.out System System.out a[ii]+" " a[ii] a ii " " System.out.println(a[N-1]) System.out.println System.out System System.out a[N-1] a N-1 N 1 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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    }
} 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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    }
} Main

import java.util.Scanner;

/**
 * Created by sd on 2016/11/22.
 */
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<N;I++){
            a[I] = sc.nextInt();
        }


        for(int ii=0; ii<N-1; ii++){
            System.out.print(a[ii]+" ");
        }
        System.out.println(a[N-1]);
        for(int i=1; i<N; i++){
            int v = a[i], j=i-1;
            while(j>=0 && a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int ii=0; ii<N-1; ii++){
                System.out.print(a[ii]+" ");
            }
            System.out.println(a[N-1]);
        }
    }
}