import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	}
} Main private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	} print {
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	} String[] V=new String[A.length]; V new String[A.length] A.length A A.length for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		} int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
			V[i]=String.valueOf(A[i]);
		} {
			V[i]=String.valueOf(A[i]);
		} V[i]=String.valueOf(A[i]) V[i] V i String.valueOf(A[i]) String.valueOf String A[i] A i System.out.println(String.join(" ",V)) System.out.println System.out System System.out String.join(" ",V) String.join String " " V int[] A A public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	} insertionSort { // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	} for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   } int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   } {
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   } 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 print(A) print A int[] A A int N N public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	} main {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        } {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            } (line = br.readLine()) != null (line = br.readLine()) line br.readLine() br.readLine br null {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            } int[] A=new int[Integer.parseInt(line)]; A new int[Integer.parseInt(line)] Integer.parseInt(line) Integer.parseInt Integer line line=br.readLine() line br.readLine() br.readLine br String[] str=line.split(" "); str line.split(" ") line.split line " " for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	} int i=0; int i=0; i 0 i<A.length i A.length A A.length i++ i++ i {
            		A[i]=Integer.parseInt(str[i]);
            	} {
            		A[i]=Integer.parseInt(str[i]);
            	} A[i]=Integer.parseInt(str[i]) A[i] A i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i insertionSort(A,A.length) insertionSort A A.length A A.length break; String[] args args public class Main {
	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	}
} public class Main {
	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	private static void print(int[] A){
		String[] V=new String[A.length];
		for(int i=0;i<A.length;i++){
			V[i]=String.valueOf(A[i]);
		}
		System.out.println(String.join(" ",V));
	}
	
	public static void insertionSort(int[] A,int N){ // N??????????´??????????0-?????????????????????
	   for(int i=0;i<A.length;i++){
		 
	     int v = A[i];
	     int j = i - 1;
	     while(j >= 0 && A[j] > v){
	       A[j+1] = A[j];
	       j--;
	     }
	     A[j+1] = v;
	     print(A);
	   }
	}
	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	int[] A=new int[Integer.parseInt(line)];
            	line=br.readLine();
            	String[] str=line.split(" ");
            	for(int i=0;i<A.length;i++){
            		A[i]=Integer.parseInt(str[i]);
            	}
            	insertionSort(A,A.length);
            	break;
            }
        }
	}
}