
import java.util.Scanner;

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

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);	
		int N = in.nextInt();
		int[] A = new int[N];
		
		for (int i = 0; i < N; i++) {
			A[i] = in.nextInt();
		}
		
		for (int k = 0; k < A.length-1; k++) {
			System.out.print(A[k] + " ");					
		}
		System.out.println(A[A.length -1]);
		for (int i = 1; i <= A.length-1; i++) {
			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 < A.length-1; k++) {
				System.out.print(A[k] + " ");					
			}
			System.out.println(A[A.length -1]);
			
		}
		
	}
}

