import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] A = new int[N]; A new int[N] N for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            A[i]=scanner.nextInt();
        } {
            A[i]=scanner.nextInt();
        } A[i]=scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner printList(A,N) printList A N insertionSort(A,N) insertionSort A N String[] args args static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    } insertionSort {
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    } for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        } int i=1; int i=1; i 1 i<N i N i++ i++ i {
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        } {
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        } int v = A[i]; v A[i] A i int j=i-1; j i-1 i 1 while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            } j>=0 && (v < A[j]) j>=0 j 0 (v < A[j]) v A[j] A j {
                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 printList(A,N) printList A N int[] A A int N N static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    } printList {
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    } StringBuilder builder = new StringBuilder(); builder new StringBuilder() for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        } {
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        } if(i>0){
                builder.append(" ");
            } i>0 i 0 {
                builder.append(" ");
            } builder.append(" ") builder.append builder " " builder.append(A[i]) builder.append builder A[i] A i System.out.println(builder) System.out.println System.out System System.out builder int[] A A int N N public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
} Main
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=scanner.nextInt();
        }
        printList(A,N);
        insertionSort(A,N);
    }
     
    static void insertionSort(int[] A,int N){
        for(int i=1;i<N;i++){
            int v = A[i];
            int j=i-1;
            while(j>=0 && (v < A[j])){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]= v;
            printList(A,N);
        }
    }
    static void printList(int[] A,int N){
        StringBuilder builder = new StringBuilder();
        for(int i=0;i<N;i++){
            if(i>0){
                builder.append(" ");
            }
            builder.append(A[i]);
        }
        System.out.println(builder);
    }
}