

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

class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		int input[] = new int[100];
		int numOfInput;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		numOfInput = Integer.parseInt(br.readLine());

		String tmpArray[] = br.readLine().split(" ");

		for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		insertionSort(input, numOfInput);



	}

	public static void insertionSort(int[] array, int n){

		printArray(array, n);
		for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		}
	}

	public static void printArray(int[] array, int n){
		for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		int input[] = new int[100];
		int numOfInput;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		numOfInput = Integer.parseInt(br.readLine());

		String tmpArray[] = br.readLine().split(" ");

		for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		insertionSort(input, numOfInput);



	}

	public static void insertionSort(int[] array, int n){

		printArray(array, n);
		for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		}
	}

	public static void printArray(int[] array, int n){
		for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		}
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		int input[] = new int[100];
		int numOfInput;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		numOfInput = Integer.parseInt(br.readLine());

		String tmpArray[] = br.readLine().split(" ");

		for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		insertionSort(input, numOfInput);



	} main {
		// TODO ?????????????????????????????????????????????
		int input[] = new int[100];
		int numOfInput;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		numOfInput = Integer.parseInt(br.readLine());

		String tmpArray[] = br.readLine().split(" ");

		for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		insertionSort(input, numOfInput);



	} int input[] = new int[100]; input new int[100] 100 int numOfInput; numOfInput BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) numOfInput = Integer.parseInt(br.readLine()) numOfInput Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String tmpArray[] = br.readLine().split(" "); tmpArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		} int i = 0; int i = 0; i 0 i < tmpArray.length i tmpArray.length tmpArray tmpArray.length i++ i++ i {
			input[i] = Integer.parseInt(tmpArray[i]);
		} {
			input[i] = Integer.parseInt(tmpArray[i]);
		} input[i] = Integer.parseInt(tmpArray[i]) input[i] input i Integer.parseInt(tmpArray[i]) Integer.parseInt Integer tmpArray[i] tmpArray i insertionSort(input, numOfInput) insertionSort input numOfInput String[] args args public static void insertionSort(int[] array, int n){

		printArray(array, n);
		for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		}
	} insertionSort {

		printArray(array, n);
		for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		}
	} printArray(array, n) printArray array n for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		} int i = 1; int i = 1; i 1 i <= n - 1 i n - 1 n 1 i++ i++ i {
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		} {
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		} int v = array[i]; v array[i] array i int j = i - 1; j i - 1 i 1 while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			} j >= 0 && array[j] > v j >= 0 j 0 array[j] > v array[j] array j v {
				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] = v array[j+1] array j+1 j 1 v printArray(array, n) printArray array n int[] array array int n n public static void printArray(int[] array, int n){
		for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		}
	} printArray {
		for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		}
	} for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		} {
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		} System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			} i < n - 1 i n - 1 n 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " {
				System.out.println();
			} System.out.println() System.out.println System.out System System.out int[] array array int n n


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

class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		int input[] = new int[100];
		int numOfInput;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		numOfInput = Integer.parseInt(br.readLine());

		String tmpArray[] = br.readLine().split(" ");

		for(int i = 0; i < tmpArray.length ; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		insertionSort(input, numOfInput);



	}

	public static void insertionSort(int[] array, int n){

		printArray(array, n);
		for(int i = 1; i <= n - 1; i++){
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;

			printArray(array, n);
		}
	}

	public static void printArray(int[] array, int n){
		for(int i = 0; i < n ; i++){
			System.out.print(array[i]);
			if(i < n - 1){
				System.out.print(" ");
			}
			else{
				System.out.println();
			}
		}
	}

}