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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	}

	public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	}

	public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    int n = Integer.parseInt(br.readLine());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	} 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 String[] numStrAry =  br.readLine().split(" "); numStrAry br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] numIntAry = new int[n]; numIntAry new int[n] n for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]); int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i numIntAry[i] = Integer.parseInt(numStrAry[i]); numIntAry[i] = Integer.parseInt(numStrAry[i]) numIntAry[i] numIntAry i Integer.parseInt(numStrAry[i]) Integer.parseInt Integer numStrAry[i] numStrAry i insertSort(n,numIntAry) insertSort n numIntAry String[] args args public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	} insertSort {

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			sb.append(numIntAry[i]);
			sb.append(" ");
		} {
			sb.append(numIntAry[i]);
			sb.append(" ");
		} sb.append(numIntAry[i]) sb.append sb numIntAry[i] numIntAry i sb.append(" ") sb.append sb " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 sb.append("\n") sb.append sb "\n" for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		} int i = 1 ; int i = 1 ; i 1 i < n i n i++ i++ i {
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		} {
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		} int j  = i - 1; j i - 1 i 1 int val = numIntAry[i]; val numIntAry[i] numIntAry i while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			} j >= 0 && val < numIntAry[j] j >= 0 j 0 val < numIntAry[j] val numIntAry[j] numIntAry j {
				numIntAry[j+1] = numIntAry[j];
				j--;
			} numIntAry[j+1] = numIntAry[j] numIntAry[j+1] numIntAry j+1 j 1 numIntAry[j] numIntAry j j-- j numIntAry[j+1] = val numIntAry[j+1] numIntAry j+1 j 1 val for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			} int x = 0 ; int x = 0 ; x 0 x < n x n x++ x++ x {
				sb.append(numIntAry[x]);
				sb.append(" ");
			} {
				sb.append(numIntAry[x]);
				sb.append(" ");
			} sb.append(numIntAry[x]) sb.append sb numIntAry[x] numIntAry x sb.append(" ") sb.append sb " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 sb.append("\n") sb.append sb "\n" sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb int n n int[] numIntAry numIntAry 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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	}

	public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	}

	public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		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());

		String[] numStrAry =  br.readLine().split(" ");
		int[] numIntAry = new int[n];

		for(int i = 0 ; i < n ; i++) numIntAry[i] = Integer.parseInt(numStrAry[i]);

		insertSort(n,numIntAry);
	}

	public static void insertSort(int n, int[] numIntAry){

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n ; i++){
			sb.append(numIntAry[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("\n");

		for(int i = 1 ; i < n ; i++){
			int j  = i - 1;
			int val = numIntAry[i];

			while(j >= 0 && val < numIntAry[j]){
				numIntAry[j+1] = numIntAry[j];
				j--;
			}
			numIntAry[j+1] = val;

			for(int x = 0 ; x < n ; x++){
				sb.append(numIntAry[x]);
				sb.append(" ");
			}
			sb.deleteCharAt(sb.length() - 1);
			sb.append("\n");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}

}