import java.util.Scanner;

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

public class Main {
	
	public static void main(String[] args) {	
		Scanner scanner = new Scanner(System.in);
		int[] a = new int[scanner.nextInt()];
		for(int i = 0; i < a.length ; i++) {
			a[i] = scanner.nextInt();
		}
		for(int k = 0; k < a.length - 1; k++) {
			System.out.print(a[k] + " ");
		}
		System.out.print(a[a.length - 1]);
		System.out.println();
		insertionSort(a);	
	}
		
	public static void insertionSort(int[] a) {
		for(int i = 1; i < a.length ; i++) {
			int key = a[i];
			int j = i;
			while(j > 0 && key < a[j - 1]) {
				j--;
				a[j+1] = a[j];
			}
			a[j] = key;
			for(int k = 0; k < a.length - 1; k++) {
				System.out.print(a[k] + " ");
			}
			System.out.print(a[a.length - 1]);
			System.out.println();
		}
	}
}

