import java.util.Scanner;
class Main {

	public static void printarray(int[] a,int n){
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	}

	public static void scanarray(int[] a,int n, Scanner s){
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	}

	public static void insertsort(int[] a,int n){
		int v,j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
	}
    public static void main(String args[]) {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];

    	scanarray(a,n,scan);
    	printarray(a,n);
    	insertsort(a,n);


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

	public static void printarray(int[] a,int n){
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	}

	public static void scanarray(int[] a,int n, Scanner s){
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	}

	public static void insertsort(int[] a,int n){
		int v,j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
	}
    public static void main(String args[]) {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];

    	scanarray(a,n,scan);
    	printarray(a,n);
    	insertsort(a,n);


    }
} Main public static void printarray(int[] a,int n){
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	} printarray {
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	} for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	} int f=0; int f=0; f 0 f<n f n f++ f++ f {
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	} {
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	} if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]); f<n-1 f n-1 n 1 System.out.print(a[f]+" ") System.out.print System.out System System.out a[f]+" " a[f] a f " " System.out.println(a[f]) System.out.println System.out System System.out a[f] a f int[] a a int n n public static void scanarray(int[] a,int n, Scanner s){
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	} scanarray {
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	} for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
    		a[i] = s.nextInt();
    	} {
    		a[i] = s.nextInt();
    	} a[i] = s.nextInt() a[i] a i s.nextInt() s.nextInt s int[] a a int n n Scanner s s public static void insertsort(int[] a,int n){
		int v,j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
	} insertsort {
		int v,j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
	} int v v j; j for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	} int i=1; int i=1; i 1 i<n i n i++ i++ i {
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	} {
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	} 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 printarray(a,n) printarray a n int[] a a int n n public static void main(String args[]) {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];

    	scanarray(a,n,scan);
    	printarray(a,n);
    	insertsort(a,n);


    } main {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];

    	scanarray(a,n,scan);
    	printarray(a,n);
    	insertsort(a,n);


    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int a[] = new int[n]; a new int[n] n scanarray(a,n,scan) scanarray a n scan printarray(a,n) printarray a n insertsort(a,n) insertsort a n String args[] args
import java.util.Scanner;
class Main {

	public static void printarray(int[] a,int n){
    	for(int f=0;f<n;f++){
    		if(f<n-1)System.out.print(a[f]+" ");
    		else System.out.println(a[f]);
    	}
	}

	public static void scanarray(int[] a,int n, Scanner s){
    	for(int i=0;i<n;i++){
    		a[i] = s.nextInt();
    	}
	}

	public static void insertsort(int[] a,int n){
		int v,j;
    	for(int i=1;i<n;i++){
    		v=a[i];
    		j=i-1;
    		while(j>=0 && a[j]>v){
    			a[j+1]=a[j];
    			j--;
    		}
    		a[j+1]=v;

    		printarray(a,n);
    	}
	}
    public static void main(String args[]) {
    	Scanner scan = new Scanner(System.in);
    	int n = scan.nextInt();
    	int a[] = new int[n];

    	scanarray(a,n,scan);
    	printarray(a,n);
    	insertsort(a,n);


    }
}