import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	}

	private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

			for (int j2 = 0; j2 < a.length; j2++) {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	}

	private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

			for (int j2 = 0; j2 < a.length; j2++) {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

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

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(sc.next());
		} {
			a[i] = Integer.parseInt(sc.next());
		} a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Insertion_Sort(a) Insertion_Sort a String[] args args private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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

				j--;

			} j >= 0 && a[j] > p j >= 0 j 0 a[j] > p a[j] a j p {
				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] = p a[j + 1] a j + 1 j 1 p for (int j2 = 0; j2 < a.length; j2++) {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			} int j2 = 0; int j2 = 0; j2 0 j2 < a.length j2 a.length a a.length j2++ j2++ j2 {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			} {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			} System.out.print(a[j2]) System.out.print System.out System System.out a[j2] a j2 if (j2 != a.length - 1) {
					System.out.print(" ");
				} j2 != a.length - 1 j2 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 class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	}

	private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

			for (int j2 = 0; j2 < a.length; j2++) {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	}

	private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

			for (int j2 = 0; j2 < a.length; j2++) {
				System.out.print(a[j2]);
				if (j2 != a.length - 1) {
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
	}
} Main
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next()); // ?¨?????????°
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		Insertion_Sort(a);

	}

	private static void Insertion_Sort(int[] a) {
		for (int i = 0; i < a.length; i++) {

			int p = a[i];
			int j = i - 1;
			while (j >= 0 && a[j] > p) {
				a[j + 1] = a[j];

				j--;

			}
			a[j + 1] = p;

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