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

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[] data = new int[num];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		}


		Main m = new Main();
		m.output(data, num);
		m.insertionSort(data, num);

	}

	public void insertionSort(int[] data, int num){

		for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		}

	}

	public void output(int[] data, int num){

		for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

	}

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

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[] data = new int[num];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		}


		Main m = new Main();
		m.output(data, num);
		m.insertionSort(data, num);

	}

	public void insertionSort(int[] data, int num){

		for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		}

	}

	public void output(int[] data, int num){

		for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

	}

} Main public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[] data = new int[num];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		}


		Main m = new Main();
		m.output(data, num);
		m.insertionSort(data, num);

	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[] data = new int[num];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		}


		Main m = new Main();
		m.output(data, num);
		m.insertionSort(data, num);

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int num = Integer.parseInt(br.readLine()); num Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] data = new int[num]; data new int[num] num String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			data[i] = Integer.parseInt(input[i]);
		} {
			data[i] = Integer.parseInt(input[i]);
		} data[i] = Integer.parseInt(input[i]) data[i] data i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i Main m = new Main(); m new Main() m.output(data, num) m.output m data num m.insertionSort(data, num) m.insertionSort m data num String[] args args public void insertionSort(int[] data, int num){

		for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		}

	} insertionSort {

		for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		}

	} for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		} int i = 1; int i = 1; i 1 i < num i num i++ i++ i {

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		} {

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		} int temp = data[i]; temp data[i] data i int j = i - 1; j i - 1 i 1 while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			} j >= 0 && data[j] > temp j >= 0 j 0 data[j] > temp data[j] data j temp {
				data[j + 1] = data[j];
				j--;
			} data[j + 1] = data[j] data[j + 1] data j + 1 j 1 data[j] data j j-- j data[j + 1] = temp data[j + 1] data j + 1 j 1 temp output(data, num) output data num int[] data data int num num public void output(int[] data, int num){

		for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

	} output {

		for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

	} for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} {

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} System.out.print(data[i]) System.out.print System.out System System.out data[i] data i if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			} i != num - 1 i num - 1 num 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " {
				System.out.print("\n");
			} System.out.print("\n") System.out.print System.out System System.out "\n" int[] data data int num num
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(br.readLine());
		int[] data = new int[num];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < num; i++){
			data[i] = Integer.parseInt(input[i]);
		}


		Main m = new Main();
		m.output(data, num);
		m.insertionSort(data, num);

	}

	public void insertionSort(int[] data, int num){

		for(int i = 1; i < num; i++){

			int temp = data[i];
			int j = i - 1;

			while(j >= 0 && data[j] > temp){
				data[j + 1] = data[j];
				j--;
			}

			data[j + 1] = temp;

			output(data, num);

		}

	}

	public void output(int[] data, int num){

		for(int i = 0; i < num; i++){

			System.out.print(data[i]);

			if(i != num - 1){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

	}

}