import java.util.Scanner;

class _insertionSort {

        // Default Constructor
        public void _insetrionSort() {
        }

        // sort method :: sort given array using insertion Sort
        public static void sort(int[] _A, int _n) {
                for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                }

        }

        // print method :: print array
        public static void print(int[] _A) {
                for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                }
                System.out.println();
        }

}
public class Main {

        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        }

} import java.util.Scanner; Scanner java.util class _insertionSort {

        // Default Constructor
        public void _insetrionSort() {
        }

        // sort method :: sort given array using insertion Sort
        public static void sort(int[] _A, int _n) {
                for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                }

        }

        // print method :: print array
        public static void print(int[] _A) {
                for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                }
                System.out.println();
        }

} _insertionSort // Default Constructor
        public void _insetrionSort() {
        } _insetrionSort {
        } // sort method :: sort given array using insertion Sort
        public static void sort(int[] _A, int _n) {
                for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                }

        } sort {
                for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                }

        } for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                } int i = 1; int i = 1; i 1 i < _n i _n ++i ++i i {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                } {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                } int tmp = _A[i]; tmp _A[i] _A i int j = i - 1; j i - 1 i 1 while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        } j >= 0 && _A[j] > tmp j >= 0 j 0 _A[j] > tmp _A[j] _A j tmp {
                                _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] = tmp _A[j + 1] _A j + 1 j 1 tmp print(_A) print _A int[] _A _A int _n _n // print method :: print array
        public static void print(int[] _A) {
                for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                }
                System.out.println();
        } print {
                for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                }
                System.out.println();
        } for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                } int i = 0; int i = 0; i 0 i < _A.length i _A.length _A _A.length ++i ++i i {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                } {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                } System.out.print(_A[i]) System.out.print System.out System System.out _A[i] _A i if (i != _A.length - 1)
                                System.out.print(" "); i != _A.length - 1 i _A.length - 1 _A.length _A _A.length 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] _A _A public class Main {

        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        }

} Main public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        } main {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = 0; n 0 int[] A; A n = sc.nextInt() n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc A = new int[n] A new int[n] n for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < n i n ++i ++i i A[i] = sc.nextInt(); A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc _insertionSort.print(A) _insertionSort.print _insertionSort A _insertionSort.sort(A, n) _insertionSort.sort _insertionSort A n sc.close() sc.close sc String[] args args public class Main {

        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        }

} public class Main {

        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        }

} Main
import java.util.Scanner;

class _insertionSort {

        // Default Constructor
        public void _insetrionSort() {
        }

        // sort method :: sort given array using insertion Sort
        public static void sort(int[] _A, int _n) {
                for (int i = 1; i < _n; ++i) {

                        // print(_A);
                        int tmp = _A[i];
                        int j = i - 1;
                        while (j >= 0 && _A[j] > tmp) {
                                _A[j + 1] = _A[j];
                                --j;
                        }
                        _A[j + 1] = tmp;
                        print(_A);
                        // System.out.println("i = " + i);
                }

        }

        // print method :: print array
        public static void print(int[] _A) {
                for (int i = 0; i < _A.length; ++i) {
                        System.out.print(_A[i]);
                        if (i != _A.length - 1)
                                System.out.print(" ");
                }
                System.out.println();
        }

}
public class Main {

        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
                ////////////////////////////////////
                int n = 0;
                int[] A;

                n = sc.nextInt();
                sc.nextLine();
                A = new int[n];
                for (int i = 0; i < n; ++i)
                        A[i] = sc.nextInt();

                _insertionSort.print(A);
                _insertionSort.sort(A, n);

                ////////////////////////////////////
                sc.close();
        }

}