import java.util.Scanner;

public class Main {

	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();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	}

	private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	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();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	}

	private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	}
} Main 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();

		run(a);

		scan.close();
		System.exit(0);
	} 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();

		run(a);

		scan.close();
		System.exit(0);
	} 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 run(a) run a scan.close() scan.close scan System.exit(0) System.exit System 0 String[] args args private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	} run {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	} for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		} int i = 1; int i = 1; i 1 i < a.length i a.length a a.length i++ i++ i {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		} {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		} printA(a) printA a int temp = a[i]; temp a[i] a i for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break; int j = i; int j = i; j i j > 0 j 0 j-- j-- j if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break; if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break; a[j - 1] > a[j] a[j - 1] a j - 1 j 1 a[j] a j {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} a[j] = a[j - 1] a[j] a j a[j - 1] a j - 1 j 1 a[j - 1] = temp a[j - 1] a j - 1 j 1 temp break; printA(a) printA a int[] a a private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	} printA {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	} for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		} {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		} if (i > 0)
				System.out.print(" "); i > 0 i 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(a[i]) System.out.print System.out System System.out a[i] a i System.out.println() System.out.println System.out System System.out int[] a a public class Main {

	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();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	}

	private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	}
} public class Main {

	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();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	}

	private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	}
} Main
import java.util.Scanner;

public class Main {

	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();

		run(a);

		scan.close();
		System.exit(0);
	}

	private static void run(int[] a) {
		for (int i = 1; i < a.length; i++) {
			printA(a);
			int temp = a[i];
			for (int j = i; j > 0; j--)
				if (a[j - 1] > a[j]) {
					a[j] = a[j - 1];
					a[j - 1] = temp;
				} else
					break;
		}
		printA(a);

	}

	private static void printA(int[] a) {
		for (int i = 0; i < a.length; i++) {
			if (i > 0)
				System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
	}
}