

import java.util.Arrays;
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();
		}
		insertionSort(A, N);
	}

	public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	}
} import java.util.Arrays; Arrays java.util 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();
		}
		insertionSort(A, N);
	}

	public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	}
} 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();
		}
		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();
		}
		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] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan insertionSort(A, N) insertionSort A N String[] args args public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	} insertionSort {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	} String output = Arrays.toString(A).replaceAll(",", ""); output Arrays.toString(A).replaceAll(",", "") Arrays.toString(A).replaceAll Arrays.toString(A) Arrays.toString Arrays A "," "" System.out.println(output.substring(1, output.length() - 1)) System.out.println System.out System System.out output.substring(1, output.length() - 1) output.substring output 1 output.length() - 1 output.length() output.length output 1 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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		} 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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		} {
			int v = A[i];
			int j = i - 1;
			// ?????§???????????????????????°???????????????????????\????????????????????????????????§??????
			while (j >= 0 && A[j] > v) {
				A[j + 1] = A[j];
				j--;
				A[j + 1] = v;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		} 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--;
				A[j + 1] = v;
			} 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] = v;
			} 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 output = Arrays.toString(A).replaceAll(",", "") output Arrays.toString(A).replaceAll(",", "") Arrays.toString(A).replaceAll Arrays.toString(A) Arrays.toString Arrays A "," "" System.out.println(output.substring(1, output.length() - 1)) System.out.println System.out System System.out output.substring(1, output.length() - 1) output.substring output 1 output.length() - 1 output.length() output.length output 1 int[] A A int N N 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();
		}
		insertionSort(A, N);
	}

	public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	}
} 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();
		}
		insertionSort(A, N);
	}

	public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	}
} Main


import java.util.Arrays;
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();
		}
		insertionSort(A, N);
	}

	public static void insertionSort(int[] A, int N) {
		// ??????????????????
		String output = Arrays.toString(A).replaceAll(",", "");
		// ?????????????????????
		System.out.println(output.substring(1, output.length() - 1));
		
		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;
			}

			output = Arrays.toString(A).replaceAll(",", "");
			System.out.println(output.substring(1, output.length() - 1));
		}
	}
}