import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	StringBuilder out;

	void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	}

	void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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

	void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	}

	void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder out; out void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	} run {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			A[i] = sc.nextInt();
		} {
			A[i] = sc.nextInt();
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc out = new StringBuilder() out new StringBuilder() print(A) print A for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		} {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		} int v = A[i]; v A[i] A i int j = i - 1; j i - 1 i 1 while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			} j >= 0 && A[j] > v j >= 0 j 0 A[j] > v A[j] A j v {
				A[j + 1] = A[j];
				j--;
			} A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j-- j A[j + 1] = v A[j + 1] A j + 1 j 1 v print(A) print A System.out.print(out) System.out.print System.out System System.out out void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	} print {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	} for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			out.append((i == 0 ? "" : " ") + A[i]);
		} {
			out.append((i == 0 ? "" : " ") + A[i]);
		} out.append((i == 0 ? "" : " ") + A[i]) out.append out (i == 0 ? "" : " ") + A[i] (i == 0 ? "" : " ") i == 0 i 0 "" " " A[i] A i out.append("\n") out.append out "\n" int[] A A void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	} debug {
		System.out.println(Arrays.deepToString(o));
	} System.out.println(Arrays.deepToString(o)) System.out.println System.out System System.out Arrays.deepToString(o) Arrays.deepToString Arrays o Object... o o public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	StringBuilder out;

	void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	}

	void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

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

	void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	}

	void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	StringBuilder out;

	void run() {
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i] = sc.nextInt();
		}
		out = new StringBuilder();
		print(A);
		for (int i = 1; i < N; i++) {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			print(A);
		}
		System.out.print(out);
	}

	void print(int[] A) {
		for (int i = 0; i < A.length; i++) {
			out.append((i == 0 ? "" : " ") + A[i]);
		}
		out.append("\n");
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}