import java.io.PrintWriter;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final PrintWriter out = new PrintWriter(System.out);
        final int n = Integer.parseInt(sc.next());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        out.print(a[0]);
        for(int i = 1; i<n; i++)
            out.print(" "+a[i]);
        out.println();
        for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        }
        out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final PrintWriter out = new PrintWriter(System.out);
        final int n = Integer.parseInt(sc.next());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        out.print(a[0]);
        for(int i = 1; i<n; i++)
            out.print(" "+a[i]);
        out.println();
        for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        }
        out.flush();
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final PrintWriter out = new PrintWriter(System.out);
        final int n = Integer.parseInt(sc.next());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        out.print(a[0]);
        for(int i = 1; i<n; i++)
            out.print(" "+a[i]);
        out.println();
        for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        }
        out.flush();
    } main {
        final Scanner sc = new Scanner(System.in);
        final PrintWriter out = new PrintWriter(System.out);
        final int n = Integer.parseInt(sc.next());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        out.print(a[0]);
        for(int i = 1; i<n; i++)
            out.print(" "+a[i]);
        out.println();
        for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        }
        out.flush();
    } final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) final int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc final int[] a = new int[n]; a new int[n] n for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            a[i] = Integer.parseInt(sc.next());
        } {
            a[i] = Integer.parseInt(sc.next());
        } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc out.print(a[0]) out.print out a[0] a 0 for(int i = 1; i<n; i++)
            out.print(" "+a[i]); int i = 1; int i = 1; i 1 i<n i n i++ i++ i out.print(" "+a[i]); out.print(" "+a[i]) out.print out " "+a[i] " " a[i] a i out.println() out.println out for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        } int i = 1; int i = 1; i 1 i<n i n i++ i++ i {
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        } {
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        } final 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 out.print(a[0]) out.print out a[0] a 0 for(int k = 1; k<n; k++)
                out.print(" "+a[k]); int k = 1; int k = 1; k 1 k<n k n k++ k++ k out.print(" "+a[k]); out.print(" "+a[k]) out.print out " "+a[k] " " a[k] a k out.println() out.println out out.flush() out.flush out String[] args args
import java.io.PrintWriter;
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final PrintWriter out = new PrintWriter(System.out);
        final int n = Integer.parseInt(sc.next());
        final int[] a = new int[n];
        for(int i = 0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        out.print(a[0]);
        for(int i = 1; i<n; i++)
            out.print(" "+a[i]);
        out.println();
        for(int i = 1; i<n; i++){
            final int v = a[i];
            int j = i-1;
            while(j>=0&&a[j]>v){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = v;
            out.print(a[0]);
            for(int k = 1; k<n; k++)
                out.print(" "+a[k]);
            out.println();
        }
        out.flush();
    }
}