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

public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    }

    public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    }

    public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    }

} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] a = new int[n]; a new int[n] n String[] t = br.readLine().split(" "); t br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = Integer.parseInt(t[i]);
        } {
            a[i] = Integer.parseInt(t[i]);
        } a[i] = Integer.parseInt(t[i]) a[i] a i Integer.parseInt(t[i]) Integer.parseInt Integer t[i] t i insertionSort(a, n) insertionSort a n String[] args args public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    } insertionSort {
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    } int i i j j v; v StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        } {
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        } 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 " " if(i == n-1)sb.append("\n"); i == n-1 i n-1 n 1 sb.append("\n") sb.append sb "\n" for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        } i = 1; i = 1 i 1 i < n i n i++ i++ i {
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        } {
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        } v = a[i] v a[i] a i 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 for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            } 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(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            } {
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            } 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 " " if(k == n-1) sb.append("\n"); k == n-1 k n-1 n 1 sb.append("\n") sb.append sb "\n" System.out.print(sb) System.out.print System.out System System.out sb int[] a a int n n public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    }

    public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    }

} public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    }

    public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }
        insertionSort(a, n);
    }

    public static void insertionSort(int[] a, int n){
        int i, j, v;
        StringBuilder sb = new StringBuilder();
        for(i = 0; i < n; i++){
            sb.append(a[i]);
            if(i != n-1)sb.append(" ");
            if(i == n-1)sb.append("\n");
        }
        for(i = 1; i < n; i++){
            v = a[i];
            j = i - 1;
            while(j >= 0 && a[j] > v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            for(int k = 0; k < n; k++){
                sb.append(a[k]);
                if(k != n-1) sb.append(" ");
                //System.out.println(sb);                                           
                //sb.delete(0, sb.length());                                        
                if(k == n-1) sb.append("\n");
            }
        }
        System.out.print(sb);
    }

}