import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    }
}
 import java.util.Scanner; Scanner java.util public class Main { 
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    }
} Main public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    } main {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i i j j k k l; l int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] = new int[N]; A new int[N] N for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        } i = 0; i = 0 i 0 i < N i N i++ i++ i {
            j = sc.nextInt();
            A[i] =j;
        } {
            j = sc.nextInt();
            A[i] =j;
        } j = sc.nextInt() j sc.nextInt() sc.nextInt sc A[i] =j A[i] A i j for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        } i = 1; i = 1 i 1 i <= N - 1 i N - 1 N 1 i++ i++ i {
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        } {
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        } for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            } k = 0; k = 0 k 0 k < N k N k++ k++ k {
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            } {
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            } System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k != N - 1) System.out.print(" "); k != N - 1 k N - 1 N 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out l = A[i] l A[i] A i j = i - 1 j i - 1 i 1 while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            } j >= 0 && A[j] > l j >= 0 j 0 A[j] > l A[j] A j l {
                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] = l A[j + 1] A j + 1 j 1 l for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        } k = 0; k = 0 k 0 k < N k N k++ k++ k {
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        } {
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        } System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if( k != N - 1) System.out.print(" "); k != N - 1 k N - 1 N 1 System.out.print(" ") System.out.print System.out System System.out " " 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 i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    }
} public class Main { 
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    }
} Main
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
        int i, j, k, l;
        int N = sc.nextInt();
        int A[] = new int[N];
        
        for(i = 0; i < N; i++){
            j = sc.nextInt();
            A[i] =j;
        }
 
        for(i = 1; i <= N - 1; i++){
            for(k = 0; k < N; k++){
                System.out.print(A[k]);
                
                if(k != N - 1) System.out.print(" ");
            }
            
            System.out.println();
            l = A[i];
            j = i - 1;
            while(j >= 0 && A[j] > l){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = l;   
        }
        for(k = 0; k < N; k++){
            System.out.print(A[k]);
            if( k != N - 1) System.out.print(" ");
        }
        System.out.println();
    }
}

