import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	}

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

	public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	}

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

	public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int [] A = new int[N]; A new int[N] N String [] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		} int i = 0; int i = 0; i 0 i < str.length i str.length str str.length i++ i++ i {
			A[i] = Integer.parseInt(str[i]);
		} {
			A[i] = Integer.parseInt(str[i]);
		} A[i] = Integer.parseInt(str[i]) A[i] A i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i insertionSort(A,N) insertionSort A N String[] args args public static void insertionSort(int[] A,int N){
		show(A);
		for(int i=1; i<N;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;
			show(A);
		}
	} insertionSort {
		show(A);
		for(int i=1; i<N;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;
			show(A);
		}
	} show(A) show A for(int i=1; i<N;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;
			show(A);
		} int i=1; int i=1; i 1 i<N i N 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;
			show(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;
			show(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 show(A) show A int[] A A int N N public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	} show {
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		} {
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		} sb.append(A[i]) sb.append sb A[i] A i if(i != A.length-1) sb.append(" "); i != A.length-1 i A.length-1 A.length A A.length 1 sb.append(" ") sb.append sb " " System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb int []A A public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	}

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

	public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	}

} public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	}

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

	public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int [] A = new int[N];
		String [] str = br.readLine().split(" ");
		for(int i = 0;i < str.length;i++){
			A[i] = Integer.parseInt(str[i]);
		}
		insertionSort(A,N);
	}

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

	public static void show(int []A){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < A.length;i++){
			sb.append(A[i]);
			if(i != A.length-1) sb.append(" ");
		}
		System.out.println(sb.toString());
	}

}