import java.util.*;

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

public class Main{
    public static void main(String[] args){
        Scanner n = new Scanner(System.in);
        int N = n.nextInt();
        int A[] = new int[N];
        for(int i=0; i < N; i++){
            A[i] = n.nextInt();
        }
        for(int i=0; i < N; i++){
            System.out.print(A[i]);
            if(i==N-1){
                System.out.println("");
            }
            else{
                System.out.print(" ");
            }
        }
        for(int i = 1; i <= N-1 ; i++){
            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.println("");
                }
                else{
                    System.out.print(" ");
                }
            }
        }
    }
}
