import java.util.Scanner;
public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
} Main public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    } main {
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int a[]=new int[n+1]; a new int[n+1] n+1 n 1 for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            a[i]=s.nextInt();
        } {
            a[i]=s.nextInt();
        } a[i]=s.nextInt() a[i] a i s.nextInt() s.nextInt s for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int j=i-1;
            while(j>=0&&a[j]>v){
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=v;
        } int i=1; int i=1; i 1 i<n i n i++ i++ i {
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            } int k=0; int k=0; k 0 k<n k n k++ k++ k {
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            } {
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            } System.out.print(a[k]) System.out.print System.out System System.out a[k] a k if(k!=n-1) System.out.print(" "); k!=n-1 k n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println("") System.out.println System.out System System.out "" 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 for(int k=0;k<n;k++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        } int k=0; int k=0; k 0 k<n k n k++ k++ k {
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        } {
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        } System.out.print(a[k]) System.out.print System.out System System.out a[k] a k if(k!=n-1) System.out.print(" "); k!=n-1 k n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println("") System.out.println System.out System System.out "" String[] av av public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
} public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] av){
         Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=s.nextInt();
        }
        for(int i=1;i<n;i++){
            for(int k=0;k<n;k++){
                System.out.print(a[k]);
                if(k!=n-1) System.out.print(" ");
            }
            System.out.println("");
            int v=a[i];
            int 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++){
             System.out.print(a[k]);
            if(k!=n-1) System.out.print(" ");
        }
        System.out.println("");
    }
}
