import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    }
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str; str str = br.readLine() str br.readLine() br.readLine br int N = Integer.parseInt(str); N Integer.parseInt(str) Integer.parseInt Integer str str = br.readLine() str br.readLine() br.readLine br String[] strs = str.split("\\s"); strs str.split("\\s") str.split str "\\s" int[] A = new int[strs.length]; A new int[strs.length] strs.length strs strs.length for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        } int i=0; int i=0; i 0 i<strs.length i strs.length strs strs.length i++ i++ i {
            A[i] = Integer.parseInt(strs[i]);
        } {
            A[i] = Integer.parseInt(strs[i]);
        } A[i] = Integer.parseInt(strs[i]) A[i] A i Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        } int i=1; int i=1; i 1 i<N i N i++ i++ i {
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        } {
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            } int k=0; int k=0; k 0 k<N k N k++ k++ k {
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            } {
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            } sb.append(A[k]) sb.append sb A[k] A k if(k != (N-1)){
                    sb.append(" ");
                } k != (N-1) k (N-1) N 1 {
                    sb.append(" ");
                } sb.append(" ") sb.append sb " " System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb 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--;
                A[j+1] = v;//in order to exchange
            } 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] = v;//in order to exchange
            } 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 StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        } {
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        } sb.append(A[i]) sb.append sb A[i] A i if(i != (N-1)){
                sb.append(" ");
            } i != (N-1) i (N-1) N 1 {
                sb.append(" ");
            } sb.append(" ") sb.append sb " " System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb br.close() br.close br String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    }
} public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    }
} Main
import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        int N = Integer.parseInt(str);
        
        str = br.readLine();
        String[] strs = str.split("\\s");
        int[] A = new int[strs.length];
        for(int i=0;i<strs.length;i++){
            A[i] = Integer.parseInt(strs[i]);
        }

        for(int i=1;i<N;i++){
            StringBuilder sb = new StringBuilder();
            for(int k=0;k<N;k++){
                sb.append(A[k]);
                if(k != (N-1)){
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
            int v = A[i];//temp
            int j = i -1;
            while(j >=0 && A[j] > v){
                A[j+1] = A[j];
                j--;
                A[j+1] = v;//in order to exchange
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i=0;i<N;i++){
            sb.append(A[i]);
            if(i != (N-1)){
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
        br.close();
    }
}
