import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_1_A(); 
	}
	public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		ALDS1_1_A(); 
	}
	public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}
} Main public static void main(String[] args) {
		ALDS1_1_A(); 
	} main {
		ALDS1_1_A(); 
	} ALDS1_1_A() ALDS1_1_A String[] args args public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	} ALDS1_1_A {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	} 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 for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		} {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		} for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			} {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			} if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				} j == n - 1 j n - 1 n 1 {
					System.out.print(a[j]);
				} System.out.print(a[j]) System.out.print System.out System System.out a[j] 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() System.out.println System.out System System.out int temp = a[i]; temp a[i] a i int j = i - 1; j i - 1 i 1 while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			} j >= 0 && temp < a[j] j >= 0 j 0 temp < a[j] temp a[j] a j {
				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] = temp a[j + 1] a j + 1 j 1 temp for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		} {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		} if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			} j == n - 1 j n - 1 n 1 {
				System.out.print(a[j]);
			} System.out.print(a[j]) System.out.print System.out System System.out a[j] 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() System.out.println System.out System System.out public class Main {
	public static void main(String[] args) {
		ALDS1_1_A(); 
	}
	public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}
} public class Main {
	public static void main(String[] args) {
		ALDS1_1_A(); 
	}
	public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_1_A(); 
	}
	public static void ALDS1_1_A() {
		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();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}
}
