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