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

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());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

} import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader 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());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    } 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 String[] input = br.readLine().split(" " , n); input br.readLine().split(" " , n) br.readLine().split br.readLine() br.readLine br " " n int[] array = new int[n]; array new int[n] n for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = Integer.parseInt(input[i]);
        } {
            array[i] = Integer.parseInt(input[i]);
        } array[i] = Integer.parseInt(input[i]) array[i] array i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i insertionSort(array) insertionSort array String[] args args static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    } insertionSort {
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    } int N = A.length; N A.length A A.length StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int k : A){
            sb.append(k + " ");
        } int k A {
            sb.append(k + " ");
        } {
            sb.append(k + " ");
        } sb.append(k + " ") sb.append sb k + " " k " " System.out.println(sb.toString().substring(0 , sb.length() - 1)) System.out.println System.out System System.out sb.toString().substring(0 , sb.length() - 1) sb.toString().substring sb.toString() sb.toString sb 0 sb.length() - 1 sb.length() sb.length sb 1 for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        } {
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        } 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--;

            } 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 StringBuilder sbs = new StringBuilder(); sbs new StringBuilder() for(int k : A){
                sbs.append(k + " ");
            } int k A {
                sbs.append(k + " ");
            } {
                sbs.append(k + " ");
            } sbs.append(k + " ") sbs.append sbs k + " " k " " System.out.println(sbs.toString().substring(0 , sbs.length() - 1)) System.out.println System.out System System.out sbs.toString().substring(0 , sbs.length() - 1) sbs.toString().substring sbs.toString() sbs.toString sbs 0 sbs.length() - 1 sbs.length() sbs.length sbs 1 int[] A A 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());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

} 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());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

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

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());
        String[] input = br.readLine().split(" " , n);
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        insertionSort(array);

    }

    static void insertionSort(int[] A){
        int N = A.length;

        //output
        StringBuilder sb = new StringBuilder();
        for(int k : A){
            sb.append(k + " ");
        }
        System.out.println(sb.toString().substring(0 , sb.length() - 1));

        for(int i = 1; i < N; i++){
            int v = A[i];
            int j = i-1;
            while(j>=0 && A[j] > v){
                A[j+1] = A[j];
                j--;

            }
            A[j+1] = v;

            //output
            StringBuilder sbs = new StringBuilder();
            for(int k : A){
                sbs.append(k + " ");
            }
            System.out.println(sbs.toString().substring(0 , sbs.length() - 1));

        }
    }

}