import java.io.*;
 
class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();
 
    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        String[] in = br.readLine().split(" ");
        for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]);
        trace(A, n);
 
        for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        }
        System.out.print(out);
    }
     
    static void trace(int A[], int n){
        for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        }
        out.append('\n');
    }
} import java.io.*; io.* java class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();
 
    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        String[] in = br.readLine().split(" ");
        for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]);
        trace(A, n);
 
        for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        }
        System.out.print(out);
    }
     
    static void trace(int A[], int n){
        for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        }
        out.append('\n');
    }
} Main static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) static StringBuilder out = new StringBuilder(); out new StringBuilder() public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        String[] in = br.readLine().split(" ");
        for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]);
        trace(A, n);
 
        for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        }
        System.out.print(out);
    } main {
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        String[] in = br.readLine().split(" ");
        for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]);
        trace(A, n);
 
        for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        }
        System.out.print(out);
    } 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[] in = br.readLine().split(" "); in br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i A[i] = Integer.parseInt(in[i]); A[i] = Integer.parseInt(in[i]) A[i] A i Integer.parseInt(in[i]) Integer.parseInt Integer in[i] in i trace(A, n) trace A n for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        } {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        } int key = A[i]; key A[i] A i int j=i-1; j i-1 i 1 while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            } j>=0 && A[j]>key j>=0 j 0 A[j]>key A[j] A j key {
                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] = key A[j+1] A j+1 j 1 key trace(A, n) trace A n System.out.print(out) System.out.print System.out System System.out out String[] args args static void trace(int A[], int n){
        for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        }
        out.append('\n');
    } trace {
        for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        }
        out.append('\n');
    } for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if(i>0) out.append(' ');
            out.append(A[i]);
        } {
            if(i>0) out.append(' ');
            out.append(A[i]);
        } if(i>0) out.append(' '); i>0 i 0 out.append(' ') out.append out ' ' out.append(A[i]) out.append out A[i] A i out.append('\n') out.append out '\n' int A[] A int n n
import java.io.*;
 
class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringBuilder out = new StringBuilder();
 
    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] A = new int[n];
        String[] in = br.readLine().split(" ");
        for (int i=0; i<n; i++) A[i] = Integer.parseInt(in[i]);
        trace(A, n);
 
        for(int i=1; i<n; i++) {
            int key = A[i];
            int j=i-1;
            while(j>=0 && A[j]>key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
            trace(A, n);
        }
        System.out.print(out);
    }
     
    static void trace(int A[], int n){
        for (int i=0; i<n; i++){
            if(i>0) out.append(' ');
            out.append(A[i]);
        }
        out.append('\n');
    }
}