import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	} run {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++)
			array[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = scan.nextInt(); array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		} {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		} for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " ")); int k = 0; int k = 0; k 0 k < n k n k++ k++ k System.out.print(array[k] + (k == n - 1 ? "": " ")); System.out.print(array[k] + (k == n - 1 ? "": " ")) System.out.print System.out System System.out array[k] + (k == n - 1 ? "": " ") array[k] array k (k == n - 1 ? "": " ") k == n - 1 k n - 1 n 1 "" " " System.out.println() System.out.println System.out System System.out int v = array[i]; v array[i] array i int j = i - 1; j i - 1 i 1 while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			} j >= 0 && array[j] > v j >= 0 j 0 array[j] > v array[j] array j v {
				array[j + 1] = array[j];
				j--;
			} array[j + 1] = array[j] array[j + 1] array j + 1 j 1 array[j] array j j-- j array[j + 1] = v array[j + 1] array j + 1 j 1 v for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " ")); int k = 0; int k = 0; k 0 k < n k n k++ k++ k System.out.print(array[k] + (k == n - 1 ? "": " ")); System.out.print(array[k] + (k == n - 1 ? "": " ")) System.out.print System.out System System.out array[k] + (k == n - 1 ? "": " ") array[k] array k (k == n - 1 ? "": " ") k == n - 1 k n - 1 n 1 "" " " System.out.println() System.out.println System.out System System.out public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] array = new int[n];
		for (int i = 0; i < n; i++)
			array[i] = scan.nextInt();
		for (int i = 1; i < n; i++) {
			for (int k = 0; k < n; k++)
				System.out.print(array[k] + (k == n - 1 ? "": " "));
			System.out.println();
			int v = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = v;
		}
		for (int k = 0; k < n; k++)
			System.out.print(array[k] + (k == n - 1 ? "": " "));
		System.out.println();
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

