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();
    }
}


/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz