import java.util.Scanner;


public class Main {
	void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			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();
		new Main().insertionSort(a, n);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			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();
		new Main().insertionSort(a, n);
	}
} Main void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			System.out.println();
		}
	} insertionSort {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			System.out.println();
		}
	} System.out.print(a[0]) System.out.print System.out System System.out a[0] a 0 for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		} int k = 1; int k = 1; k 1 k < n k n 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() System.out.println System.out System System.out 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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			System.out.println();
		} 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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			System.out.println();
		} {
			int v = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > v) {
				a[j+1] = a[j];
				j--;
			}
			a[j+1] = v;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			System.out.println();
		} 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 System.out.print(a[0]) System.out.print System.out System System.out a[0] a 0 for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			} int k = 1; int k = 1; k 1 k < n k n 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() System.out.println System.out System System.out int[] a a int n n 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();
		new Main().insertionSort(a, n);
	} 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();
		new Main().insertionSort(a, n);
	} 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] a i scan.nextInt() scan.nextInt scan new Main().insertionSort(a, n) new Main().insertionSort new Main() a n String[] args args public class Main {
	void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			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();
		new Main().insertionSort(a, n);
	}
} public class Main {
	void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			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();
		new Main().insertionSort(a, n);
	}
} Main
import java.util.Scanner;


public class Main {
	void insertionSort(int[] a, int n) {
		System.out.print(a[0]);
		for (int k = 1; k < n; k++) {
			System.out.print(" " + a[k]);
		}
		System.out.println();
		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;
			System.out.print(a[0]);
			for (int k = 1; k < n; k++) {
				System.out.print(" " + a[k]);
			}
			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();
		new Main().insertionSort(a, n);
	}
}