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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	}
} 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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	}
} 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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	} 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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	} 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 int tmp tmp k; k for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		} {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		} for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			} int j = 0; int j = 0; j 0 j < N - 1 j N - 1 N 1 j++ j++ j {
				System.out.print(A[j] + " ");
			} {
				System.out.print(A[j] + " ");
			} System.out.print(A[j] + " ") System.out.print System.out System System.out A[j] + " " A[j] A j " " System.out.println(A[N - 1]) System.out.println System.out System System.out A[N - 1] A N - 1 N 1 tmp = A[i] tmp A[i] A i k = i - 1 k i - 1 i 1 while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			} k >= 0 && A[k] > tmp k >= 0 k 0 A[k] > tmp A[k] A k tmp {
				A[k + 1] = A[k];
				k--;
			} A[k + 1] = A[k] A[k + 1] A k + 1 k 1 A[k] A k k-- k A[k + 1] = tmp A[k + 1] A k + 1 k 1 tmp for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		} int i = 0; int i = 0; i 0 i < N - 1 i N - 1 N 1 i++ i++ i {
			System.out.print(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 " " 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 = sc.nextInt();
		
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	}
} 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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	}
} 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();
		}
		
		int tmp, k;
		
		for(int i = 1; i < N; i++) {
			for(int j = 0; j < N - 1; j++) {
				System.out.print(A[j] + " ");
			}
			System.out.println(A[N - 1]);
			
			tmp = A[i];
			k = i - 1;
			
			while(k >= 0 && A[k] > tmp) {
				A[k + 1] = A[k];
				k--;
			}
			
			A[k + 1] = tmp;
		}
		
		for(int i = 0; i < N - 1; i++) {
			System.out.print(A[i] + " ");
		}
		System.out.println(A[N - 1]);
	}
}