import java.util.Scanner;

public class Main {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

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

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    } main {

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int i i j j k k key key n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] array = new int[n]; array new int[n] n for(i = 0; i < n; ++i) array[i] = scanner.nextInt(); i = 0; i = 0 i 0 i < n i n ++i ++i i array[i] = scanner.nextInt(); array[i] = scanner.nextInt() array[i] array i scanner.nextInt() scanner.nextInt scanner for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        } i = 1; i = 1 i 1 i < array.length i array.length array array.length ++i ++i i {
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        } {
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        } output(array) output array key = array[i] key array[i] array i 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 output(array) output array scanner.close() scanner.close scanner String[] args args public class Main {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
} public class Main {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void output(int array[]){
        int k;
        for(k = 0; k < array.length - 1; ++k) System.out.print(array[k] + " ");
        System.out.println(array[k]);
    }

    public static void main(String[] args){

        Scanner scanner = new Scanner(System.in);
        int i, j, k, key, n = scanner.nextInt();
        int[] array = new int[n];
        for(i = 0; i < n; ++i) array[i] = scanner.nextInt();

        for(i = 1; i < array.length; ++i){
            output(array);
            key = array[i];
            j = i - 1;
            while(j >= 0 && array[j] > key){
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = key;
        }
        output(array);
        scanner.close();
    }
}
