import java.util.Scanner;

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

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