import java.util.*;
public class Main {
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    } main {
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int i i j j reg reg k; k int[] ary = new int[n]; ary new int[n] n for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	} i=0; i=0 i 0 i<n i n i++ i++ i {
    		ary[i]=sc.nextInt();
    	} {
    		ary[i]=sc.nextInt();
    	} ary[i]=sc.nextInt() ary[i] ary i sc.nextInt() sc.nextInt sc for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	} k=0; k=0 k 0 k<n k n k++ k++ k {
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	} {
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	} System.out.print(ary[k]) System.out.print System.out System System.out ary[k] ary k if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        } k!=n-1 k n-1 n 1 {
	        	 System.out.print(" ");
	        } System.out.print(" ") System.out.print System.out System System.out " " {
	        	System.out.println();
	        } System.out.println() System.out.println System.out System System.out for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	} i=0; i=0 i 0 i<n i n i++ i++ i {
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	} {
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	} j=i j i if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		} i!=0 i 0 {
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		} while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   } j!=0&&ary[j]<ary[j-1] j!=0 j 0 ary[j]<ary[j-1] ary[j] ary j ary[j-1] ary j-1 j 1 {
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   } reg=ary[j-1] reg ary[j-1] ary j-1 j 1 ary[j-1]=ary[j] ary[j-1] ary j-1 j 1 ary[j] ary j ary[j]=reg ary[j] ary j reg j-- j for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    } k=0; k=0 k 0 k<n k n k++ k++ k {
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    } {
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    } System.out.print(ary[k]) System.out.print System.out System System.out ary[k] ary k if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        } k!=n-1 k n-1 n 1 {
			        	 System.out.print(" ");
			        } System.out.print(" ") System.out.print System.out System System.out " " {
			        	System.out.println();
			        } System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    }
} public class Main {
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n=sc.nextInt();
    	int i,j,reg,k;
    	int[] ary = new int[n];
    	for(i=0;i<n;i++){
    		ary[i]=sc.nextInt();
    	}
    	for(k=0;k<n;k++){
	        System.out.print(ary[k]);
	        if(k!=n-1){
	        	 System.out.print(" ");
	        }else{
	        	System.out.println();
	        }
    	}
    	for(i=0;i<n;i++){
    		j=i;
    		if(i!=0){
    		    while(j!=0&&ary[j]<ary[j-1]){
    			    reg=ary[j-1];
    			    ary[j-1]=ary[j];
    			    ary[j]=reg;
    			        j--;
    		   }
			    for(k=0;k<n;k++){
			        System.out.print(ary[k]);
			        if(k!=n-1){
			        	 System.out.print(" ");
			        }else{
			        	System.out.println();
			        }
			    }
    		}
    	}
    }
}
