import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	}
	static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	}
	static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	}
} Main public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	} main {
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	} Scanner sc= new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A=new int[N]; A new int[N] N for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			A[i]=sc.nextInt();
		} {
			A[i]=sc.nextInt();
		} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		} {
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		} if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			} i==N-1 i N-1 N 1 {
				System.out.println(A[i]);					
			} System.out.println(A[i]) System.out.println System.out System System.out A[i] A i {
			System.out.print(A[i]+" ");
			} System.out.print(A[i]+" ") System.out.print System.out System System.out A[i]+" " A[i] A i " " insertionSort(A,N) insertionSort A N String[] args args static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	} insertionSort {
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	} for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		} int i=1; int i=1; i 1 i<ar.length i ar.length ar ar.length i++ i++ i {
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		} {
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		} int key=ar[i]; key ar[i] ar i int j=i-1; j i-1 i 1 while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			} j>=0&&ar[j]>key j>=0 j 0 ar[j]>key ar[j] ar j key {
				ar[j+1]=ar[j];
				j--;
			} ar[j+1]=ar[j] ar[j+1] ar j+1 j 1 ar[j] ar j j-- j ar[j+1]=key ar[j+1] ar j+1 j 1 key for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			} int k=0; int k=0; k 0 k<n k n k++ k++ k {
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			} {
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			} if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				} k==n-1 k n-1 n 1 {
					System.out.println(ar[k]);					
				} System.out.println(ar[k]) System.out.println System.out System System.out ar[k] ar k {
				System.out.print(ar[k]+" ");
				} System.out.print(ar[k]+" ") System.out.print System.out System System.out ar[k]+" " ar[k] ar k " " int[] ar ar int n n public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	}
	static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	}
	static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int N=sc.nextInt();
		int[] A=new int[N]; 
		for(int i=0;i<N;i++){
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++){
			if(i==N-1){
				System.out.println(A[i]);					
			}else{
			System.out.print(A[i]+" ");
			}
		}
		insertionSort(A,N);
	}
	static void insertionSort(int[] ar,int n){
		for(int i=1;i<ar.length;i++){
			int key=ar[i];
			int j=i-1;
			while(j>=0&&ar[j]>key){
				ar[j+1]=ar[j];
				j--;
			}
			ar[j+1]=key;
			for(int k=0;k<n;k++){
				if(k==n-1){
					System.out.println(ar[k]);					
				}else{
				System.out.print(ar[k]+" ");
				}
			}
		}
	}
}