import java.util.*;

public class Main {

	void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	}

	void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}
 import java.util.*; util.* java public class Main {

	void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	}

	void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	} insertionSort {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	} for (int i = 1; i < A.length; 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;
			printArray(A);
		} int i = 1; int i = 1; i 1 i < A.length i A.length A A.length 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;
			printArray(A);
		} {
			int v = A[i];
			int j = i - 1;
			while (j >= 0 && A[j] > v) {
				A[j+1] = A[j];
				j--;
			}
			A[j+1] = v;
			printArray(A);
		} 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--;
			} 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] = 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 printArray(A) printArray A int[] A A void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	} printArray {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	} System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		} int i = 1; int i = 1; i 1 i < A.length i A.length A A.length i++ i++ i {
			System.out.print(" " + A[i]);
		} {
			System.out.print(" " + A[i]);
		} System.out.print(" " + A[i]) System.out.print System.out System System.out " " + A[i] " " A[i] A i System.out.println() System.out.println System.out System System.out int[] A A void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	} run {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	} 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 < A.length; i++) {
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan printArray(A) printArray A insertionSort(A) insertionSort A public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	} main {
		// TODO Auto-generated method stub
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {

	void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	}

	void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} public class Main {

	void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	}

	void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main
import java.util.*;

public class Main {

	void insertionSort(int[] A) {
		for (int i = 1; i < A.length; 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;
			printArray(A);
		}
	}

	void printArray(int[] A) {
		System.out.print(A[0]);
		for (int i = 1; i < A.length; i++) {
			System.out.print(" " + A[i]);
		}
		System.out.println();
	}

	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] A = new int[n];
		for (int i = 0; i < A.length; i++) {
			A[i] = scan.nextInt();
		}
		printArray(A);
		insertionSort(A);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

