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