import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	}

} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	} main {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int N=scan.nextInt(); N scan.nextInt() scan.nextInt scan int i i j j v v n n A[]=new int[N]; A new int[N] N for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		} i=0; i=0 i 0 i<N i N i++ i++ i {
			A[i]=scan.nextInt();
		} {
			A[i]=scan.nextInt();
		} A[i]=scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		} n=0; n=0 n 0 n<N n N n++ n++ n {
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		} {
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		} if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			} n!=N-1 n N-1 N 1 {
				System.out.print(A[n]+" ");
			} System.out.print(A[n]+" ") System.out.print System.out System System.out A[n]+" " A[n] A n " " {
				System.out.println(A[n]);
			} System.out.println(A[n]) System.out.println System.out System System.out A[n] A n for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		} i=1; i=1 i 1 i<N i N i++ i++ i {
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		} {
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		} v=A[i] v A[i] A i j=i-1 j i-1 i 1 while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			} 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]=v;
			} 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 for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			} n=0; n=0 n 0 n<N n N n++ n++ n {
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			} {
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			} if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				} n!=N-1 n N-1 N 1 {
					System.out.print(A[n]+" ");
				} System.out.print(A[n]+" ") System.out.print System.out System System.out A[n]+" " A[n] A n " " {
					System.out.println(A[n]);
				} System.out.println(A[n]) System.out.println System.out System System.out A[n] A n String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int i,j,v,n,A[]=new int[N];
		for(i=0;i<N;i++){
			A[i]=scan.nextInt();
		}
		for(n=0;n<N;n++){
			if(n!=N-1){
				System.out.print(A[n]+" ");
			}
			else{
				System.out.println(A[n]);
			}
		}
		for(i=1;i<N;i++){
			v=A[i];
			j=i-1;
			while(j>=0 && A[j]>v ){
				A[j+1]=A[j];
				j--;
				A[j+1]=v;
			}
			for(n=0;n<N;n++){
				if(n!=N-1){
					System.out.print(A[n]+" ");
				}
				else{
					System.out.println(A[n]);
				}
			}
		}
	}

}