import java.util.Scanner;

public class Main
{

    public static int number;
    public static int[] A=new int[1000];

    public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    }

    public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    }
} import java.util.Scanner; Scanner java.util public class Main
{

    public static int number;
    public static int[] A=new int[1000];

    public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    }

    public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    }
} Main public static int number; number public static int[] A=new int[1000]; A new int[1000] 1000 public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    } main {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) number=scan.nextInt() number scan.nextInt() scan.nextInt scan for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        } int i=0; int i=0; i 0 i<number i number i++ i++ i {
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        } {
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        } A[i]=scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan if(i!=number-1) System.out.print(A[i]+" "); i!=number-1 i number-1 number 1 System.out.print(A[i]+" ") System.out.print System.out System System.out A[i]+" " A[i] A i " " if(i==number-1) System.out.print(A[i]); i==number-1 i number-1 number 1 System.out.print(A[i]) System.out.print System.out System System.out A[i] A i System.out.println() System.out.println System.out System System.out insertionSort() insertionSort String[] args args public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    } insertionSort {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    } int v v j=0; j 0 for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        } int i=1; int i=1; i 1 i<=number-1 i number-1 number 1 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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        } {
            v = A[i];
            j=i-1;
            while(j>=0 && A[j]>v)
            {
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=v;

            for(int l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        } 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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            } int l=0; int l=0; l 0 l<number l number l++ l++ l {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            } {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            } if (l != number - 1) System.out.print(A[l] + " "); l != number - 1 l number - 1 number 1 System.out.print(A[l] + " ") System.out.print System.out System System.out A[l] + " " A[l] A l " " if (l == number - 1) System.out.print(A[l]); l == number - 1 l number - 1 number 1 System.out.print(A[l]) System.out.print System.out System System.out A[l] A l System.out.println() System.out.println System.out System System.out public class Main
{

    public static int number;
    public static int[] A=new int[1000];

    public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    }

    public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    }
} public class Main
{

    public static int number;
    public static int[] A=new int[1000];

    public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    }

    public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    }
} Main
import java.util.Scanner;

public class Main
{

    public static int number;
    public static int[] A=new int[1000];

    public static void main(String[] args)
    {
        
        Scanner scan=new Scanner(System.in);
        number=scan.nextInt();

        for(int i=0;i<number;i++){
            A[i]=scan.nextInt();
            if(i!=number-1) System.out.print(A[i]+" ");
            if(i==number-1) System.out.print(A[i]);
        }
        System.out.println();

        insertionSort();

    }

    public static void insertionSort()
    {
        int v,j=0;
        for(int i=1;i<=number-1;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 l=0;l<number;l++)
            {
                if (l != number - 1) System.out.print(A[l] + " ");
                if (l == number - 1) System.out.print(A[l]);
            }
            System.out.println();
        }

    }
}