import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	}

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


	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] A = new int[n]; A new int[n] n for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			A[i]= Integer.parseInt(sc.next());
		} {
			A[i]= Integer.parseInt(sc.next());
		} A[i]= Integer.parseInt(sc.next()) A[i] A i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		} {
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		} for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			} int k=0; int k=0; k 0 k<n-1 k n-1 n 1 k++ k++ k {
				System.out.print(A[k]+" ");
			} {
				System.out.print(A[k]+" ");
			} System.out.print(A[k]+" ") System.out.print System.out System System.out A[k]+" " A[k] A k " " System.out.println(A[n-1]) System.out.println System.out System System.out A[n-1] A n-1 n 1 int key = A[i]; key A[i] A i int 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 for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		} int k=0; int k=0; k 0 k<n-1 k n-1 n 1 k++ k++ k {
			System.out.print(A[k]+" ");
		} {
			System.out.print(A[k]+" ");
		} System.out.print(A[k]+" ") System.out.print System.out System System.out A[k]+" " A[k] A k " " System.out.println(A[n-1]) System.out.println System.out System System.out A[n-1] A n-1 n 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] A = new int[n];
		for(int i=0;i<n;i++){
			A[i]= Integer.parseInt(sc.next());
		}
		
		for (int i=1; i<n;i++){
			for(int k=0;k<n-1;k++){
				System.out.print(A[k]+" ");
			}
			System.out.println(A[n-1]);
			
			int key = A[i];
			int j=i-1;
			while(j>=0 && A[j]>key){
				A[j+1]=A[j];
				j--;
			}
			A[j+1]=key;
		}
		
		for(int k=0;k<n-1;k++){
			System.out.print(A[k]+" ");
		}
		System.out.println(A[n-1]);


	}

}