import java.util.*;

public class Main {
	public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	}

} import java.util.*; util.* java public class Main {
	public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	}

} Main public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	} main {
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	} Scanner input=new Scanner(System.in); input new Scanner(System.in) int loop=input.nextInt(); loop input.nextInt() input.nextInt input int[] keepNum=new int[loop]; keepNum new int[loop] loop for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt(); int i=0; int i=0; i 0 i<loop i loop i++ i++ i keepNum[i]=input.nextInt(); keepNum[i]=input.nextInt() keepNum[i] keepNum i input.nextInt() input.nextInt input for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		} int i=0; int i=0; i 0 i<loop i loop i++ i++ i {
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		} {
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		} if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]); i!=loop-1 i loop-1 loop 1 System.out.print(keepNum[i]+" ") System.out.print System.out System System.out keepNum[i]+" " keepNum[i] keepNum i " " System.out.print(keepNum[i]) System.out.print System.out System System.out keepNum[i] keepNum i System.out.println() System.out.println System.out System System.out for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		} int i=1; int i=1; i 1 i<keepNum.length i keepNum.length keepNum keepNum.length i++ i++ i {
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		} {
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		} int insert=keepNum[i]; insert keepNum[i] keepNum i int j=i-1; j i-1 i 1 while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			} j>=0 && keepNum[j]>insert j>=0 j 0 keepNum[j]>insert keepNum[j] keepNum j insert {
				keepNum[j+1]=keepNum[j];
				j--;
			} keepNum[j+1]=keepNum[j] keepNum[j+1] keepNum j+1 j 1 keepNum[j] keepNum j j-- j keepNum[j+1]=insert keepNum[j+1] keepNum j+1 j 1 insert for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		} int k=0; int k=0; k 0 k<keepNum.length k keepNum.length keepNum keepNum.length k++ k++ k {
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		} {
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		} if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]); k!=keepNum.length-1 k keepNum.length-1 keepNum.length keepNum keepNum.length 1 System.out.print(keepNum[k]+" ") System.out.print System.out System System.out keepNum[k]+" " keepNum[k] keepNum k " " System.out.print(keepNum[k]) System.out.print System.out System System.out keepNum[k] keepNum k System.out.println() System.out.println System.out System System.out String[] a a public class Main {
	public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	}

} public class Main {
	public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	}

} Main
import java.util.*;

public class Main {
	public static void main(String[] a){
		Scanner input=new Scanner(System.in);
		int loop=input.nextInt();
		int[] keepNum=new int[loop];
		
		for(int i=0;i<loop;i++)
			keepNum[i]=input.nextInt();
		
		for(int i=0;i<loop;i++){
			if(i!=loop-1)
			System.out.print(keepNum[i]+" ");
			else
				System.out.print(keepNum[i]);
		}
		System.out.println();
		
		for(int i=1;i<keepNum.length;i++){
			int insert=keepNum[i];
			int j=i-1;
			
			while(j>=0 && keepNum[j]>insert){
				keepNum[j+1]=keepNum[j];
				j--;
			}
			keepNum[j+1]=insert;
			
		for(int k=0;k<keepNum.length;k++){
			if(k!=keepNum.length-1)
			System.out.print(keepNum[k]+" ");
			else
				System.out.print(keepNum[k]);
		}
		System.out.println();
			
		}
	
	}

}