import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	}

	public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	}

	public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	}

} 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[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	}

	public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	}

	public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] untreatedArr = new int[N]; untreatedArr new int[N] N for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			untreatedArr[i] = scan.nextInt();
		} {
			untreatedArr[i] = scan.nextInt();
		} untreatedArr[i] = scan.nextInt() untreatedArr[i] untreatedArr i scan.nextInt() scan.nextInt scan dispArr(untreatedArr) dispArr untreatedArr insertionSort(untreatedArr,N) insertionSort untreatedArr N scan.close() scan.close scan String[] args args public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	} insertionSort {
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	} for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		} int i = 1; int i = 1; i 1 i <= N - 1 i N - 1 N 1 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;
			dispArr(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;
			dispArr(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 dispArr(A) dispArr A int[] A A int N N public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	} dispArr {
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	} for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		} {
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		} if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]); i != A.length - 1 i A.length - 1 A.length A A.length 1 System.out.print(A[i] + " ") System.out.print System.out System System.out A[i] + " " A[i] A i " " System.out.println(A[i]) System.out.println System.out System System.out A[i] A i int[] A A public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	}

	public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	}

	public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	}

	public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	}

	public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] untreatedArr = new int[N];

		for(int i = 0; i < N; i++){
			untreatedArr[i] = scan.nextInt();
		}

		dispArr(untreatedArr);
		insertionSort(untreatedArr,N);

		scan.close();
	}

	public static void insertionSort(int[] A,int N){
		for(int i = 1; i <= N - 1; 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;
			dispArr(A);
		}
	}

	public static void dispArr(int[] A){
		for(int i = 0; i < A.length; i++){
			if(i != A.length - 1) System.out.print(A[i] + " ");
			else System.out.println(A[i]);
		}
	}

}