

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {

    private static void print_arr (int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println();
    }

    private static int[] sort(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        }
        print_arr(arr);
        return arr;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        int size = Integer.parseInt(reader.readLine());
        String[] str = reader.readLine().trim().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        reader.close();
        sort(arr);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util class Main {

    private static void print_arr (int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println();
    }

    private static int[] sort(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        }
        print_arr(arr);
        return arr;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        int size = Integer.parseInt(reader.readLine());
        String[] str = reader.readLine().trim().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        reader.close();
        sort(arr);
    }
} Main private static void print_arr (int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println();
    } print_arr {
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println();
    } for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        } int i = 0; int i = 0; i 0 i < arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 i++ i++ i {
            System.out.print(arr[i] + " ");
        } {
            System.out.print(arr[i] + " ");
        } System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " System.out.print(arr[arr.length - 1]) System.out.print System.out System System.out arr[arr.length - 1] arr arr.length - 1 arr.length arr arr.length 1 System.out.println() System.out.println System.out System System.out int[] arr arr private static int[] sort(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        }
        print_arr(arr);
        return arr;
    } sort {
        for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        }
        print_arr(arr);
        return arr;
    } for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        } int i = 1; int i = 1; i 1 i < arr.length i arr.length arr arr.length i++ i++ i {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        } {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        } print_arr(arr) print_arr arr int key = arr[i]; key arr[i] arr i int j = i - 1; j i - 1 i 1 while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            } j >= 0 && arr[j] > key j >= 0 j 0 arr[j] > key arr[j] arr j key {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            } arr[j + 1] = arr[j] arr[j + 1] arr j + 1 j 1 arr[j] arr j j-- j arr[j + 1] = key arr[j + 1] arr j + 1 j 1 key print_arr(arr) print_arr arr return arr; arr int[] arr arr public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        int size = Integer.parseInt(reader.readLine());
        String[] str = reader.readLine().trim().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        reader.close();
        sort(arr);
    } main {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        int size = Integer.parseInt(reader.readLine());
        String[] str = reader.readLine().trim().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        reader.close();
        sort(arr);
    } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)); reader new BufferedReader(
                new InputStreamReader(System.in)) int size = Integer.parseInt(reader.readLine()); size Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader String[] str = reader.readLine().trim().split(" "); str reader.readLine().trim().split(" ") reader.readLine().trim().split reader.readLine().trim() reader.readLine().trim reader.readLine() reader.readLine reader " " int[] arr = new int[size]; arr new int[size] size for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
            arr[i] = Integer.parseInt(str[i]);
        } {
            arr[i] = Integer.parseInt(str[i]);
        } arr[i] = Integer.parseInt(str[i]) arr[i] arr i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i reader.close() reader.close reader sort(arr) sort arr String[] args args


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {

    private static void print_arr (int[] arr) {
        for (int i = 0; i < arr.length - 1; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print(arr[arr.length - 1]);
        System.out.println();
    }

    private static int[] sort(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            print_arr(arr);
            int key = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j--;
                arr[j + 1] = key;
            }
        }
        print_arr(arr);
        return arr;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in));
        int size = Integer.parseInt(reader.readLine());
        String[] str = reader.readLine().trim().split(" ");
        int[] arr = new int[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        reader.close();
        sort(arr);
    }
}