
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = scanner.nextInt();
		} {
			A[i] = scanner.nextInt();
		} A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		} int i = 1; int i = 1; i 1 i < N + 1 i N + 1 N 1 i++ i++ i {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		} {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		} for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			} {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			} if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]); k == 0 k 0 System.out.print(A[k]) System.out.print System.out System System.out A[k] A k System.out.print(" " + A[k]) System.out.print System.out System System.out " " + A[k] " " A[k] A k System.out.println() System.out.println System.out System System.out if (i == N)
				break; i == N i N break; 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 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = scanner.nextInt();
		}
		for (int i = 1; i < N + 1; i++) {
			for (int k = 0; k < N; k++) {
				if (k == 0)
					System.out.print(A[k]);
				else
					System.out.print(" " + A[k]);
			}
			System.out.println();
			if (i == N)
				break;
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
		}
	}
}