import java.util.Scanner;


public class Main {
	
	public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	}

} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	}

} Main public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	} insertionSort {
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	} Integer i i j j k k v; v for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		} k=0; k=0 k 0 k<index k index k++ k++ k {
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		} {
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k!=index-1)System.out.print(" "); k!=index-1 k index-1 index 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		} i=1; i=1 i 1 i<index i index 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;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		} {
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		} 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(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			} k=0; k=0 k 0 k<index k index k++ k++ k {
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			} {
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k!=index-1)System.out.print(" "); k!=index-1 k index-1 index 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int [] A A int index index public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Integer i i n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int [] box = new int [n]; box new int [n] n for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		} i=0; i=0 i 0 i<n i n i++ i++ i {
			box[i] = sc.nextInt();
		} {
			box[i] = sc.nextInt();
		} box[i] = sc.nextInt() box[i] box i sc.nextInt() sc.nextInt sc insertionSort(box,n) insertionSort box n String[] args args public class Main {
	
	public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	}

} public class Main {
	
	public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	}

} Main
import java.util.Scanner;


public class Main {
	
	public static void insertionSort(int [] A,int index){
		Integer i,j,k,v;
		
		for(k=0;k<index;k++){
			System.out.print(A[k]);
			if(k!=index-1)System.out.print(" ");
		}
		System.out.println();
		for(i=1;i<index;i++){
			v = A[i];
			j=i-1;
			
			while(j>=0 && A[j] > v){
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			for(k=0;k<index;k++){
				System.out.print(A[k]);
				if(k!=index-1)System.out.print(" ");
			}
			System.out.println();
		}
		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		Integer i,n = sc.nextInt();
		int [] box = new int [n];
		
		
		for(i=0;i<n;i++){
			box[i] = sc.nextInt();
		}
		insertionSort(box,n);
	}

}
