import java.util.Scanner;

class Main {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		insertionSort(array);
		scan.close();

	}

	private static void insertionSort(int[] A) {
		// N個の要素を含む0-オリジンの配列A
		int v = 0;
		int j = 0;
		for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

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

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		insertionSort(array);
		scan.close();

	}

	private static void insertionSort(int[] A) {
		// N個の要素を含む0-オリジンの配列A
		int v = 0;
		int j = 0;
		for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		}
	}
} Main public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		insertionSort(array);
		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		insertionSort(array);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num; num num = scan.nextInt() num scan.nextInt() scan.nextInt scan int[] array = new int[num]; array new int[num] num for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			array[i] = scan.nextInt();
		} {
			array[i] = scan.nextInt();
		} array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan insertionSort(array) insertionSort array scan.close() scan.close scan String args[] args private static void insertionSort(int[] A) {
		// N個の要素を含む0-オリジンの配列A
		int v = 0;
		int j = 0;
		for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		}
	} insertionSort {
		// N個の要素を含む0-オリジンの配列A
		int v = 0;
		int j = 0;
		for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		}
	} int v = 0; v 0 int j = 0; j 0 for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		} {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		} v = A[i] v A[i] A i j = i - 1 j i - 1 i 1 while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			} j >= 0 && A[j] > v j >= 0 j 0 A[j] > v A[j] A j v {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			} A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j -= 1 j 1 A[j + 1] = v A[j + 1] A j + 1 j 1 v for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			} int n = 0; int n = 0; n 0 n < A.length n A.length A A.length n++ n++ n {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			} {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			} if (n > 0) {
					System.out.print(" ");
				} n > 0 n 0 {
					System.out.print(" ");
				} System.out.print(" ") System.out.print System.out System System.out " " System.out.print(A[n]) System.out.print System.out System System.out A[n] A n System.out.print("\r\n") System.out.print System.out System System.out "\r\n" int[] A A
import java.util.Scanner;

class Main {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int num;
		num = scan.nextInt();
		int[] array = new int[num];
		for (int i = 0; i < num; i++) {
			array[i] = scan.nextInt();
		}
		insertionSort(array);
		scan.close();

	}

	private static void insertionSort(int[] A) {
		// N個の要素を含む0-オリジンの配列A
		int v = 0;
		int j = 0;
		for (int i = 0; i < A.length; i++) {
			v = A[i];
			j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j -= 1;
				A[j + 1] = v;

			}
			for (int n = 0; n < A.length; n++) {
				if (n > 0) {
					System.out.print(" ");
				}
				System.out.print(A[n]);
			}
			System.out.print("\r\n");

		}
	}
}
