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 j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	}

	static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	}

	static void print(int A[]){
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	}
} 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 j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	}

	static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	}

	static void print(int A[]){
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[n];
		for(int j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[n];
		for(int j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		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 j = 0; j < n; j++){
			a[j] = scan.nextInt();
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			a[j] = scan.nextInt();
		} {
			a[j] = scan.nextInt();
		} a[j] = scan.nextInt() a[j] a j scan.nextInt() scan.nextInt scan scan.close() scan.close scan InsertionSort(a, n) InsertionSort a n String[] args args static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	} InsertionSort {
		print(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;
			print(A);
		}
	} print(A) print 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;
			print(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;
			print(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;
			print(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 print(A) print A int A[] A int N N static void print(int A[]){
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	} print {
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	} for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		} int k = 0; int k = 0; k 0 k < A.length k A.length A A.length k++ k++ k {
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		} {
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		} if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			} k == A.length - 1 k A.length - 1 A.length A A.length 1 {
				System.out.println(A[k]);
			} System.out.println(A[k]) System.out.println System.out System System.out A[k] 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 " " int A[] A 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 j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	}

	static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	}

	static void print(int A[]){
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	}
} 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 j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	}

	static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	}

	static void print(int A[]){
		for(int k = 0; k < A.length; k++){
			if(k == A.length - 1){
				System.out.println(A[k]);
			}else{
				System.out.print(A[k] + " ");
			}
		}
	}
} 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 a[] = new int[n];
		for(int j = 0; j < n; j++){
			a[j] = scan.nextInt();
		}
		scan.close();
		InsertionSort(a, n);
	}

	static void InsertionSort(int A[], int N){
		print(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;
			print(A);
		}
	}

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