import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[100];
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			array[i] = sc.nextInt();
		
		doInsertionSort(array, n);
		
		printArray(array, n);
	
	}
	public static void doInsertionSort(int[] array, int n) {
		for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		}
	}
	public static void printArray(int[] array, int n) {
		for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[100];
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			array[i] = sc.nextInt();
		
		doInsertionSort(array, n);
		
		printArray(array, n);
	
	}
	public static void doInsertionSort(int[] array, int n) {
		for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		}
	}
	public static void printArray(int[] array, int n) {
		for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[100];
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			array[i] = sc.nextInt();
		
		doInsertionSort(array, n);
		
		printArray(array, n);
	
	} main {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[100];
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			array[i] = sc.nextInt();
		
		doInsertionSort(array, n);
		
		printArray(array, n);
	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] array = new int[100]; array new int[100] 100 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 0; i < n; i++)
			array[i] = sc.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i array[i] = sc.nextInt(); array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc doInsertionSort(array, n) doInsertionSort array n printArray(array, n) printArray array n String[] args args public static void doInsertionSort(int[] array, int n) {
		for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		}
	} doInsertionSort {
		for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		}
	} for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		} {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		} printArray(array, n) printArray array n int val = array[i]; val array[i] array i int j = i - 1; j i - 1 i 1 while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			} j >= 0 && array[j] > val j >= 0 j 0 array[j] > val array[j] array j val {
				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] = val array[j + 1] array j + 1 j 1 val int[] array array int n n public static void printArray(int[] array, int n) {
		for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	} printArray {
		for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	} for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		} {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[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(array[i]) System.out.print System.out System System.out array[i] array i System.out.print("\n") System.out.print System.out System System.out "\n" int[] array array int n n
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[100];
		
		int n = sc.nextInt();
		for (int i = 0; i < n; i++)
			array[i] = sc.nextInt();
		
		doInsertionSort(array, n);
		
		printArray(array, n);
	
	}
	public static void doInsertionSort(int[] array, int n) {
		for (int i = 1; i < n; i++) {
			printArray(array, n);
			int val = array[i];
			int j = i - 1;
			while (j >= 0 && array[j] > val) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = val;
		}
	}
	public static void printArray(int[] array, int n) {
		for (int i = 0; i < n; i++) {
			if (i != 0) 
				System.out.print(" ");
			System.out.print(array[i]);
		}
		System.out.print("\n");
	}
}