import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

	}

} Main public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

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

	} Scanner cin=new Scanner(System.in); cin new Scanner(System.in) int n=cin.nextInt() n cin.nextInt() cin.nextInt cin A[]=new int[n]; A new int[n] n for(int i=0;i<n;i++)A[i]=cin.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i A[i]=cin.nextInt(); A[i]=cin.nextInt() A[i] A i cin.nextInt() cin.nextInt cin for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		} {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		} for(int j=0;j<n-1;j++)System.out.print(A[j]+" "); int j=0; int j=0; j 0 j<n-1 j n-1 n 1 j++ j++ j System.out.print(A[j]+" "); System.out.print(A[j]+" ") System.out.print System.out System System.out A[j]+" " A[j] A j " " System.out.println(A[n-1]) System.out.println System.out System System.out A[n-1] A n-1 n 1 int v=A[i]; v A[i] A i int 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 j=0;j<n-1;j++)System.out.print(A[j]+" "); int j=0; int j=0; j 0 j<n-1 j n-1 n 1 j++ j++ j System.out.print(A[j]+" "); System.out.print(A[j]+" ") System.out.print System.out System System.out A[j]+" " A[j] A j " " 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 cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		int n=cin.nextInt(),A[]=new int[n];
		for(int i=0;i<n;i++)A[i]=cin.nextInt();
		
		for(int i=1;i<n;i++) {
			for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
			System.out.println(A[n-1]);
			
			int v=A[i];
			int j=i-1;
			while(j>=0 && A[j]>v) {
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=v;
		}
		for(int j=0;j<n-1;j++)System.out.print(A[j]+" ");
		System.out.println(A[n-1]);

	}

}
