import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    }

    /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    }

    /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

} Main public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    } main {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    } List<String> input = inputLines(); input inputLines() inputLines int length = Integer.valueOf(input.get(0)); length Integer.valueOf(input.get(0)) Integer.valueOf Integer input.get(0) input.get input 0 String[] numbersString = input.get(1).split(" "); numbersString input.get(1).split(" ") input.get(1).split input.get(1) input.get input 1 " " int[] numbers = new int[length]; numbers new int[length] length for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        } int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
            numbers[i] = Integer.valueOf(numbersString[i]);
        } {
            numbers[i] = Integer.valueOf(numbersString[i]);
        } numbers[i] = Integer.valueOf(numbersString[i]) numbers[i] numbers i Integer.valueOf(numbersString[i]) Integer.valueOf Integer numbersString[i] numbersString i int[] A = numbers; A numbers for (int i = 1; i <= A.length-1; i++) {
            output(A);
            int key = A[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
        } int i = 1; int i = 1; i 1 i <= A.length-1 i A.length-1 A.length A A.length 1 i++ i++ i {
            output(A);
            int key = A[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
        } {
            output(A);
            int key = A[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
        } output(A) output A int key = A[i]; key A[i] A i int j = i - 1; j i - 1 i 1 while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            } j >= 0 && A[j] > key j >= 0 j 0 A[j] > key A[j] A j key {
                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] = key A[j+1] A j+1 j 1 key output(A) output A String[] args args private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    } mocups {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    } List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                ); input Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                ) Arrays.asList Arrays "6" "5 2 4 6 1 3" return input; input /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    } output {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    } System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", "")) System.out.println System.out System System.out Arrays.toString(o).replaceAll("[\\[,\\]]", "") Arrays.toString(o).replaceAll Arrays.toString(o) Arrays.toString Arrays o "[\\[,\\]]" "" int[] o o /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    } inputLines {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) List<String> input = new ArrayList<String>(); input new ArrayList<String>() while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        } in.hasNext() in.hasNext in {
            String buf = in.nextLine();
            input.add(buf);
        } String buf = in.nextLine(); buf in.nextLine() in.nextLine in input.add(buf) input.add input buf in.close() in.close in return input; input public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    }

    /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

} public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    }

    /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        // input data
        List<String> input = inputLines();
        
        // get input
        int length = Integer.valueOf(input.get(0));
        String[] numbersString = input.get(1).split(" ");
        int[] numbers = new int[length];
        for (int i = 0; i < length; i++) {
            numbers[i] = Integer.valueOf(numbersString[i]);
        }
        int[] A = numbers;

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

    }

    private static List<String> mocups() {
        List<String> input = Arrays.asList(
                "6",
                "5 2 4 6 1 3"
                );
        return input;
    }

    /** output data */
    private static void output(int[] o) {
        System.out.println(Arrays.toString(o).replaceAll("[\\[,\\]]", ""));
    }

    /** input data */
    private static List<String> inputLines() {
        Scanner in = new Scanner(System.in);
        List<String> input = new ArrayList<String>();
        while(in.hasNext()) {
            String buf = in.nextLine();
            input.add(buf);
        }
        in.close();
        return input;
    }

}