import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] rank = new int[n];
		String[] str = (br.readLine()).split(" ");
		for (int i = 0; i < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		}
		//??°????????????
		for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		}

		int key;
		//sort
		for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		}
	}
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] rank = new int[n];
		String[] str = (br.readLine()).split(" ");
		for (int i = 0; i < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		}
		//??°????????????
		for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		}

		int key;
		//sort
		for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		}
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] rank = new int[n];
		String[] str = (br.readLine()).split(" ");
		for (int i = 0; i < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		}
		//??°????????????
		for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		}

		int key;
		//sort
		for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] rank = new int[n];
		String[] str = (br.readLine()).split(" ");
		for (int i = 0; i < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		}
		//??°????????????
		for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		}

		int key;
		//sort
		for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		}
	} 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[] rank = new int[n]; rank 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 < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			rank[i] = Integer.parseInt(str[i]);
		} {
			rank[i] = Integer.parseInt(str[i]);
		} rank[i] = Integer.parseInt(str[i]) rank[i] rank i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		} {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		} if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			} i < n-1 i n-1 n 1 {
				System.out.print(rank[i]+" ");
			} System.out.print(rank[i]+" ") System.out.print System.out System System.out rank[i]+" " rank[i] rank i " " {
				System.out.println(rank[i]);
			} System.out.println(rank[i]) System.out.println System.out System System.out rank[i] rank i int key; key for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		} int i = 1; int i = 1; i 1 i <= rank.length-1 i rank.length-1 rank.length rank rank.length 1 i++ i++ i {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		} {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		} key = rank[i] key rank[i] rank i int j = i-1; j i-1 i 1 while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			} j>=0 && rank[j]>key j>=0 j 0 rank[j]>key rank[j] rank j key {
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			} rank[j+1] = rank[j] rank[j+1] rank j+1 j 1 rank[j] rank j j-- j rank[j+1] = key rank[j+1] rank j+1 j 1 key for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			} int k = 0; int k = 0; k 0 k<n k n k++ k++ k {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			} {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			} if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				} k < n-1 k n-1 n 1 {
					System.out.print(rank[k]+" ");
				} System.out.print(rank[k]+" ") System.out.print System.out System System.out rank[k]+" " rank[k] rank k " " {
					System.out.println(rank[k]);
				} System.out.println(rank[k]) System.out.println System.out System System.out rank[k] rank k String[] args args
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] rank = new int[n];
		String[] str = (br.readLine()).split(" ");
		for (int i = 0; i < n ; i++ ) {
			rank[i] = Integer.parseInt(str[i]);
		}
		//??°????????????
		for (int i = 0;  i<n ; i++ ) {
			if ( i < n-1) {
				System.out.print(rank[i]+" ");
			}else{
				System.out.println(rank[i]);
			}


		}

		int key;
		//sort
		for ( int i = 1; i <= rank.length-1 ; i++ ) {
			key = rank[i];
			int j = i-1;
			while(j>=0 && rank[j]>key){
				rank[j+1] = rank[j];
				j--;
				rank[j+1] = key;
			}
		//output
			for (int k = 0;  k<n ; k++ ) {
				if ( k < n-1) {
					System.out.print(rank[k]+" ");
				}else{
					System.out.println(rank[k]);
				}


			}
		}
	}
}