import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    }

    static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    }

    static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    }

    static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    }

    static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    }
} Main public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    } main {
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    } int n; n Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n sc.reset() sc.reset sc for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc insertionSort(a,n) insertionSort a n String[] args args static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    } insertionSort {
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    } showArrays(arrays) showArrays arrays int i i j j v; v for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        } i=1; i=1 i 1 i<n i n i++ i++ i {
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        } {
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        } v=arrays[i] v arrays[i] arrays i j=i-1 j i-1 i 1 while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            } j>=0 && arrays[j]>v j>=0 j 0 arrays[j]>v arrays[j] arrays j v {
                arrays[j+1] = arrays[j];
                j--;
            } arrays[j+1] = arrays[j] arrays[j+1] arrays j+1 j 1 arrays[j] arrays j j-- j arrays[j+1] = v arrays[j+1] arrays j+1 j 1 v showArrays(arrays) showArrays arrays int[] arrays arrays int n n static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    } showArrays {
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    } String str = ""; str "" for(int a: arrays){
            str += Integer.toString(a)+ " ";
        } int a arrays {
            str += Integer.toString(a)+ " ";
        } {
            str += Integer.toString(a)+ " ";
        } str += Integer.toString(a)+ " " str Integer.toString(a)+ " " Integer.toString(a) Integer.toString Integer a " " System.out.println(str.trim()) System.out.println System.out System System.out str.trim() str.trim str int[] arrays arrays public class Main{
    public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    }

    static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    }

    static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    }
} public class Main{
    public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    }

    static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    }

    static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int[] a = new int[n];
        sc.reset();
        for(int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }
        insertionSort(a,n);
//        System.out.println(Arrays.toString(a));
    }

    static void insertionSort(int[] arrays, int n){
        showArrays(arrays);
        int i,j,v;
        for(i=1;i<n;i++){
            v=arrays[i];
            j=i-1;
            while(j>=0 && arrays[j]>v){
                arrays[j+1] = arrays[j];
                j--;
            }
            arrays[j+1] = v;
            showArrays(arrays);
        }
    }

    static void showArrays(int[] arrays){
        String str = "";
        for(int a: arrays){
            str += Integer.toString(a)+ " ";
        }
        System.out.println(str.trim());
    }
}