import java.util.Scanner;

public class Main {

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	}

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

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	}

} Main static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	} printArray {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	} for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		} {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if (i != a.length - 1) {
				System.out.print(" ");
			} i != a.length - 1 i a.length - 1 a.length a a.length 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] a a public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] A = new int[n]; A new int[n] n for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan printArray(A) printArray A for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		} {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		} int key = A[i]; key A[i] A i int j; j for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			} j = i - 1; j = i - 1 j i - 1 i 1 j >= 0 && A[j] > key j >= 0 j 0 A[j] > key A[j] A j key j-- j-- j {
				A[j+1] = A[j];
			} {
				A[j+1] = A[j];
			} A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j A[j+1] = key A[j+1] A j+1 j 1 key printArray(A) printArray A scan.close() scan.close scan String[] args args public class Main {

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	}

} public class Main {

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	}

} Main
import java.util.Scanner;

public class Main {

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);

			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = scan.nextInt();
		}

		printArray(A);
		for (int i = 1; i < n; i++) {
			int key = A[i];
			int j;
			for (j = i - 1; j >= 0 && A[j] > key; j--) {
				A[j+1] = A[j];
			}
			A[j+1] = key;
			printArray(A);
		}

		scan.close();
	}

}