import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

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

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	} main {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc int[] a = new int[n]; a new int[n] n for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		} int i=0; int i=0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			sb.append(a[i] + " ");
		} {
			sb.append(a[i] + " ");
		} sb.append(a[i] + " ") sb.append sb a[i] + " " a[i] a i " " sb.append(a[n-1] + "\n") sb.append sb a[n-1] + "\n" a[n-1] a n-1 n 1 "\n" System.out.print(sb) System.out.print System.out System System.out sb for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		} int i=1; int i=1; i 1 i <= n-1 i n-1 n 1 i++ i++ i {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		} {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		} 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]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> 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]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> 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 for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			} int k=0; int k=0; k 0 k < n-1 k n-1 n 1 k++ k++ k {
				System.out.print(a[k] + " ");
			} {
				System.out.print(a[k] + " ");
			} System.out.print(a[k] + " ") System.out.print System.out System System.out a[k] + " " a[k] a k " " System.out.println(a[n-1]) System.out.println System.out System System.out a[n-1] a n-1 n 1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		StringBuilder sb = new StringBuilder();
		for (int i=0; i < n-1; i++) {
			sb.append(a[i] + " ");
		}
		sb.append(a[n-1] + "\n");

		System.out.print(sb);

		for (int i=1; i <= n-1; i++) {

			int v = a[i]; // v : temp
			int j = i - 1;

			while ( j >=0 && a[j] > v ) {

				a[j+1] = a[j]; // a[j] -> a[j+1]
				j--;
				a[j+1] = v;
				// temp -> a[j]
				// j--
			}

			for (int k=0; k < n-1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.println(a[n-1]);

		}
	}

}