import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    } main {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int array[] = new int[n]; array new int[n] n for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        } {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if(i<array.length-1) {
                System.out.print(" ");
                
            } i<array.length-1 i array.length-1 array.length array array.length 1 {
                System.out.print(" ");
                
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out sc.close() sc.close sc for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    } int i=1; int i=1; i 1 i<array.length i array.length array array.length i++ i++ i {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    } {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    } int key = array[i]; key array[i] array i int j = i-1; j i-1 i 1 while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            } j>=0 && array[j]>key j>=0 j 0 array[j]>key array[j] array j key {
                array[j+1] = array[j];
                j--;
            } array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j-- j array[j+1] = key array[j+1] array j+1 j 1 key for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        } int num=0; int num=0; num 0 num<array.length num array.length array array.length num++ num++ num {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        } {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        } System.out.print(array[num]) System.out.print System.out System System.out array[num] array num if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            } num != array.length-1 num array.length-1 array.length array array.length 1 {
                    System.out.print(" ");
                } System.out.print(" ") System.out.print System.out System System.out " " {
                System.out.println();
            } System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    }
} Main
import java.util.*;

/**
 * A
 */
public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int array[] = new int[n];

        for(int i=0; i<n; i++) {
            
            array[i] = sc.nextInt();
            System.out.print(array[i]);
            
            if(i<array.length-1) {
                System.out.print(" ");
                
            }
            
        }

        System.out.println();

        sc.close();

        for(int i=1; i<array.length; i++) {
            
            int key = array[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i-1;
            while(j>=0 && array[j]>key) {
                array[j+1] = array[j];
                j--;
            }
            array[j+1] = key;

            for(int num=0; num<array.length; num++) {
                System.out.print(array[num]);
                if(num != array.length-1) {
                    System.out.print(" ");
                } else {
                System.out.println();
            }
        }
    }

    }
}
