import java.util.Scanner;
import java.util.StringJoiner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    }

    private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    }
} import java.util.Scanner; Scanner java.util import java.util.StringJoiner; StringJoiner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    }

    private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    } main {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int size = Integer.parseInt(scanner.next()); size Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int[] array = new int[size]; array new int[size] size for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            array[i] = Integer.parseInt(scanner.next());
        } {
            array[i] = Integer.parseInt(scanner.next());
        } array[i] = Integer.parseInt(scanner.next()) array[i] array i Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        } int i = 1; int i = 1; i 1 i < size i size i++ i++ i {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        } {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        } System.out.println(concat(array)) System.out.println System.out System System.out concat(array) concat array int value = array[i]; value array[i] array i int j = i - 1; j i - 1 i 1 while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            } j >= 0 && array[j] > value j >= 0 j 0 array[j] > value array[j] array j value {
                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] = value array[j + 1] array j + 1 j 1 value System.out.println(concat(array)) System.out.println System.out System System.out concat(array) concat array String[] args args private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    } concat {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    } StringJoiner joiner = new StringJoiner(" "); joiner new StringJoiner(" ") for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        } int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
            joiner.add(String.valueOf(array[i]));
        } {
            joiner.add(String.valueOf(array[i]));
        } joiner.add(String.valueOf(array[i])) joiner.add joiner String.valueOf(array[i]) String.valueOf String array[i] array i return joiner.toString(); joiner.toString() joiner.toString joiner int[] array array public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    }

    private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    }

    private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    }
} Main
import java.util.Scanner;
import java.util.StringJoiner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = Integer.parseInt(scanner.next());
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = Integer.parseInt(scanner.next());
        }

        for (int i = 1; i < size; i++) {
            System.out.println(concat(array));
            int value = array[i];
            int j = i - 1;
            while (j >= 0 && array[j] > value) {
                array[j + 1] = array[j];
                j--;
            }
            array[j + 1] = value;
        }
        System.out.println(concat(array));
    }

    private static String concat(int[] array) {
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = 0; i < array.length; i++) {
            joiner.add(String.valueOf(array[i]));
        }
        return joiner.toString();
    }
}