import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2019-04-30
 */
public class Main {

    private int N;
    private int[] array;

    public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    }

    private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    }

    public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    }

    public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    private int N;
    private int[] array;

    public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    }

    private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    }

    public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    }

    public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    }
} Main private int N; N private int[] array; array public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    } init {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    } N = sc.nextInt() N sc.nextInt() sc.nextInt sc array = new int[N] array new int[N] N for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        } int idx = 0; int idx = 0; idx 0 idx < N idx N idx++ idx++ idx {
            array[idx] = sc.nextInt();
        } {
            array[idx] = sc.nextInt();
        } array[idx] = sc.nextInt() array[idx] array idx sc.nextInt() sc.nextInt sc Scanner sc sc private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    } printArray {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    } for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        } int idx = 0; int idx = 0; idx 0 idx < N-1 idx N-1 N 1 idx++ idx++ idx {
            System.out.print(array[idx] + " ");
        } {
            System.out.print(array[idx] + " ");
        } System.out.print(array[idx] + " ") System.out.print System.out System System.out array[idx] + " " array[idx] array idx " " System.out.println(array[N-1]) System.out.println System.out System System.out array[N-1] array N-1 N 1 public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    } insertionSort {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    } printArray() printArray for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        } int idx = 1; int idx = 1; idx 1 idx < N idx N idx++ idx++ idx {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        } {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        } int currEle = array[idx]; currEle array[idx] array idx int preIdx = idx-1; preIdx idx-1 idx 1 while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            } (preIdx >= 0)
                    && (array[preIdx] > currEle) (preIdx >= 0) preIdx 0 (array[preIdx] > currEle) array[preIdx] array preIdx currEle {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            } array[preIdx+1] = array[preIdx] array[preIdx+1] array preIdx+1 preIdx 1 array[preIdx] array preIdx preIdx -= 1 preIdx 1 array[preIdx+1] = currEle array[preIdx+1] array preIdx+1 preIdx 1 currEle printArray() printArray public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    } main {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    } Main insertionSort = new Main(); insertionSort new Main() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) insertionSort.init(sc) insertionSort.init insertionSort sc insertionSort.insertionSort() insertionSort.insertionSort insertionSort String[] args args public class Main {

    private int N;
    private int[] array;

    public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    }

    private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    }

    public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    }

    public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    }
} public class Main {

    private int N;
    private int[] array;

    public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    }

    private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    }

    public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    }

    public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    }
} Main
import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2019-04-30
 */
public class Main {

    private int N;
    private int[] array;

    public void init(Scanner sc) {
        N = sc.nextInt();
        array = new int[N];
        for (int idx = 0; idx < N; idx++) {
            array[idx] = sc.nextInt();
        }
    }

    private void printArray() {
        for (int idx = 0; idx < N-1; idx++) {
            System.out.print(array[idx] + " ");
        }
        System.out.println(array[N-1]);
    }

    public void insertionSort() {
        printArray();
        for (int idx = 1; idx < N; idx++) {
            int currEle = array[idx];
            int preIdx = idx-1;
            while ((preIdx >= 0)
                    && (array[preIdx] > currEle)) {
                array[preIdx+1] = array[preIdx];
                preIdx -= 1;
            }
            array[preIdx+1] = currEle;
            printArray();
        }
    }

    public static void main(String[] args) {
        Main insertionSort = new Main();
        Scanner sc = new Scanner(System.in);
        insertionSort.init(sc);
        insertionSort.insertionSort();
    }
}

