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

public class Main {

	public static void print_ary(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.print("\n");
	}

	public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	}

	public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	}

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

	public static void print_ary(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.print("\n");
	}

	public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	}

	public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	}

} Main public static void print_ary(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.print("\n");
	} print_ary {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if (i != a.length - 1) {
				System.out.print(" ");
			}
		}
		System.out.print("\n");
	} 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.print("\n") System.out.print System.out System System.out "\n" int[] a a public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	} my_insertion_sort {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	} print_ary(a) print_ary a for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		} int i = 1; int i = 1; i 1 i < a.length i a.length a a.length i++ i++ i {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		} {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		} int key = a[i]; key a[i] a i int j = i - 1; j i - 1 i 1 while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			} j >= 0 && a[j] > key j >= 0 j 0 a[j] > key a[j] a j key {
				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] = key a[j+1] a j+1 j 1 key print_ary(a) print_ary a int[] a a public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	} main {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = s.nextInt();
		} {
			a[i] = s.nextInt();
		} a[i] = s.nextInt() a[i] a i s.nextInt() s.nextInt s my_insertion_sort(a) my_insertion_sort a String[] args args public class Main {

	public static void print_ary(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.print("\n");
	}

	public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	}

	public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	}

} public class Main {

	public static void print_ary(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.print("\n");
	}

	public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	}

	public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	}

} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void print_ary(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.print("\n");
	}

	public static void my_insertion_sort(int[] a) {
		print_ary(a);
		for (int i = 1; i < a.length; i++) {
			int key = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > key) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = key;
			print_ary(a);
		}
	}

	public static void main(String[] args) {
		// Collect input
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = s.nextInt();
		}
		// Sort
		my_insertion_sort(a);
	}

}

