import java.util.Scanner;

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

		int row = stdIn.nextInt();
		int[] numbers = new int[row];

		for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		}

		insertionSort(numbers, row);

	}

	static void insertionSort(int[] numbers, int row) {
		int j;
		int tmp;

		for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		}
		for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		}
		System.out.println(numbers[row - 1]);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int row = stdIn.nextInt();
		int[] numbers = new int[row];

		for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		}

		insertionSort(numbers, row);

	}

	static void insertionSort(int[] numbers, int row) {
		int j;
		int tmp;

		for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		}
		for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		}
		System.out.println(numbers[row - 1]);
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int row = stdIn.nextInt();
		int[] numbers = new int[row];

		for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		}

		insertionSort(numbers, row);

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

		int row = stdIn.nextInt();
		int[] numbers = new int[row];

		for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		}

		insertionSort(numbers, row);

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int row = stdIn.nextInt(); row stdIn.nextInt() stdIn.nextInt stdIn int[] numbers = new int[row]; numbers new int[row] row for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < row i row i++ i++ i {
			numbers[i] = stdIn.nextInt();
		} {
			numbers[i] = stdIn.nextInt();
		} numbers[i] = stdIn.nextInt() numbers[i] numbers i stdIn.nextInt() stdIn.nextInt stdIn insertionSort(numbers, row) insertionSort numbers row String[] args args static void insertionSort(int[] numbers, int row) {
		int j;
		int tmp;

		for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		}
		for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		}
		System.out.println(numbers[row - 1]);
	} insertionSort {
		int j;
		int tmp;

		for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		}
		for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		}
		System.out.println(numbers[row - 1]);
	} int j; j int tmp; tmp for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		} int i = 1; int i = 1; i 1 i < row i row i++ i++ i {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		} {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		} for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			} int k = 0; int k = 0; k 0 k < row - 1 k row - 1 row 1 k++ k++ k {
				System.out.print(numbers[k] + " ");
			} {
				System.out.print(numbers[k] + " ");
			} System.out.print(numbers[k] + " ") System.out.print System.out System System.out numbers[k] + " " numbers[k] numbers k " " System.out.println(numbers[row - 1]) System.out.println System.out System System.out numbers[row - 1] numbers row - 1 row 1 tmp = numbers[i] tmp numbers[i] numbers i j = i - 1 j i - 1 i 1 while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			} j >= 0 && numbers[j] > tmp j >= 0 j 0 numbers[j] > tmp numbers[j] numbers j tmp {
				numbers[j + 1] = numbers[j];
				j--;
			} numbers[j + 1] = numbers[j] numbers[j + 1] numbers j + 1 j 1 numbers[j] numbers j j-- j numbers[j + 1] = tmp numbers[j + 1] numbers j + 1 j 1 tmp for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		} int k = 0; int k = 0; k 0 k < row - 1 k row - 1 row 1 k++ k++ k {
			System.out.print(numbers[k] + " ");
		} {
			System.out.print(numbers[k] + " ");
		} System.out.print(numbers[k] + " ") System.out.print System.out System System.out numbers[k] + " " numbers[k] numbers k " " System.out.println(numbers[row - 1]) System.out.println System.out System System.out numbers[row - 1] numbers row - 1 row 1 int[] numbers numbers int row row
import java.util.Scanner;

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

		int row = stdIn.nextInt();
		int[] numbers = new int[row];

		for (int i = 0; i < row; i++) {
			numbers[i] = stdIn.nextInt();
		}

		insertionSort(numbers, row);

	}

	static void insertionSort(int[] numbers, int row) {
		int j;
		int tmp;

		for (int i = 1; i < row; i++) {
			for (int k = 0; k < row - 1; k++) {
				System.out.print(numbers[k] + " ");
			}
			System.out.println(numbers[row - 1]);
			tmp = numbers[i];
			j = i - 1;
			while (j >= 0 && numbers[j] > tmp) {
				numbers[j + 1] = numbers[j];
				j--;
			}
			numbers[j + 1] = tmp;
		}
		for (int k = 0; k < row - 1; k++) {
			System.out.print(numbers[k] + " ");
		}
		System.out.println(numbers[row - 1]);
	}
}