import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	}
	
	static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	}
	static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	}
	
	static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	}
	static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	}
} Main public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	} main {
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	} ArrayList<Integer> A = new ArrayList<Integer>(); A new ArrayList<Integer>() Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			A.add(scanner.nextInt());
		} {
			A.add(scanner.nextInt());
		} A.add(scanner.nextInt()) A.add A scanner.nextInt() scanner.nextInt scanner printList(A,N) printList A N insertionSort(A,N) insertionSort A N String[] args args static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	} insertionSort {
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	} for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		} {
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		} int v = A.get(i); v A.get(i) A.get A i int j=i-1; j i-1 i 1 while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			} j>=0 && (v < A.get(j)) j>=0 j 0 (v < A.get(j)) v A.get(j) A.get A j {
				A.set(j+1,A.get(j));
				j--;
			} A.set(j+1,A.get(j)) A.set A j+1 j 1 A.get(j) A.get A j j-- j A.set(j+1, v) A.set A j+1 j 1 v printList(A,N) printList A N ArrayList<Integer> A A int N N static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	} printList {
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	} StringBuilder builder = new StringBuilder(); builder new StringBuilder() for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		} {
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		} if(i>0){
				builder.append(" ");
			} i>0 i 0 {
				builder.append(" ");
			} builder.append(" ") builder.append builder " " builder.append(A.get(i)) builder.append builder A.get(i) A.get A i System.out.println(builder) System.out.println System.out System System.out builder ArrayList<Integer> A A int N N public class Main{
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	}
	
	static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	}
	static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	}
} public class Main{
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	}
	
	static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	}
	static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		ArrayList<Integer> A = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		for(int i=0;i<N;i++){
			A.add(scanner.nextInt());
		}
		printList(A,N);
		insertionSort(A,N);
	}
	
	static void insertionSort(ArrayList<Integer> A,int N){
		for(int i=1;i<N;i++){
			int v = A.get(i);
			int j=i-1;
			while(j>=0 && (v < A.get(j))){
				A.set(j+1,A.get(j));
				j--;
			}
			//??????????±????i????????????v??????j??????????????\??????????????????????????\?????????
			A.set(j+1, v);
			printList(A,N);
		}
	}
	static void printList(ArrayList<Integer> A,int N){
		StringBuilder builder = new StringBuilder();
		for(int i=0;i<N;i++){
			if(i>0){
				builder.append(" ");
			}
			builder.append(A.get(i));
		}
		System.out.println(builder);
	}
}