import java.util.Scanner;

class Main {

	public static void main(String[] a) {
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result[] = new int[n];
		for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		}
		sc.close();

		// 出力
		for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	}
} import java.util.Scanner; Scanner java.util class Main {

	public static void main(String[] a) {
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result[] = new int[n];
		for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		}
		sc.close();

		// 出力
		for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	}
} Main public static void main(String[] a) {
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result[] = new int[n];
		for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		}
		sc.close();

		// 出力
		for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	} main {
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result[] = new int[n];
		for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		}
		sc.close();

		// 出力
		for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int result[] = new int[n]; result new int[n] n for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < result.length i result.length result result.length i++ i++ i {
			result[i] = sc.nextInt();
		} {
			result[i] = sc.nextInt();
		} result[i] = sc.nextInt() result[i] result i sc.nextInt() sc.nextInt sc sc.close() sc.close sc for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		} int j2 = 0; int j2 = 0; j2 0 j2 < result.length j2 result.length result result.length j2++ j2++ j2 {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		} {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		} System.out.print(result[j2]) System.out.print System.out System System.out result[j2] result j2 if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			} j2 < result.length - 1 j2 result.length - 1 result.length result result.length 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 for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		} int i = 1; int i = 1; i 1 i < result.length i result.length result result.length i++ i++ i {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		} {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		} int keep = result[i]; keep result[i] result i int j = i - 1; j i - 1 i 1 while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			} j >= 0 && keep < result[j] j >= 0 j 0 keep < result[j] keep result[j] result j {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			} result[j + 1] = result[j] result[j + 1] result j + 1 j 1 result[j] result j j-- j result[j + 1] = keep result[j + 1] result j + 1 j 1 keep for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			} int j2 = 0; int j2 = 0; j2 0 j2 < result.length j2 result.length result result.length j2++ j2++ j2 {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			} {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			} System.out.print(result[j2]) System.out.print System.out System System.out result[j2] result j2 if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				} j2 < result.length - 1 j2 result.length - 1 result.length result result.length 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 String[] a a
import java.util.Scanner;

class Main {

	public static void main(String[] a) {
		// 入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result[] = new int[n];
		for (int i = 0; i < result.length; i++) {
			result[i] = sc.nextInt();
		}
		sc.close();

		// 出力
		for (int j2 = 0; j2 < result.length; j2++) {
			System.out.print(result[j2]);
			if (j2 < result.length - 1) {
				System.out.print(" ");
			} else {
				System.out.println();
			}
		}
		for (int i = 1; i < result.length; i++) {
			int keep = result[i];
			int j = i - 1;
			while (j >= 0 && keep < result[j]) {
				result[j + 1] = result[j];
				j--;
				result[j + 1] = keep;
			}
			for (int j2 = 0; j2 < result.length; j2++) {
				System.out.print(result[j2]);
				if (j2 < result.length - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	}
}