import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int v = 0; v 0 int j = 0; j 0 int N[] = new int[n]; N new int[n] n for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int x = scanner.nextInt();
			N[i] = x;
		} {
			int x = scanner.nextInt();
			N[i] = x;
		} int x = scanner.nextInt(); x scanner.nextInt() scanner.nextInt scanner N[i] = x N[i] N i x for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			} int k = 0; int k = 0; k 0 k < n - 1 k n - 1 n 1 k++ k++ k {
			System.out.print (N[k] + " ");
			} {
			System.out.print (N[k] + " ");
			} System.out.print (N[k] + " ") System.out.print System.out System System.out N[k] + " " N[k] N k " " System.out.println (N[n - 1]) System.out.println System.out System System.out N[n - 1] N n - 1 n 1 for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		} {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		} v = N[i] v N[i] N i j = i - 1 j i - 1 i 1 while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				} j >= 0 && N[j] > v j >= 0 j 0 N[j] > v N[j] N j v {
				N[j + 1] = N[j];
				j--;
				} N[j + 1] = N[j] N[j + 1] N j + 1 j 1 N[j] N j j-- j N[j + 1] = v N[j + 1] N j + 1 j 1 v for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				} int k = 0; int k = 0; k 0 k < n - 1 k n - 1 n 1 k++ k++ k {
				System.out.print (N[k] + " ");
				} {
				System.out.print (N[k] + " ");
				} System.out.print (N[k] + " ") System.out.print System.out System System.out N[k] + " " N[k] N k " " System.out.println (N[n - 1]) System.out.println System.out System System.out N[n - 1] N n - 1 n 1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int v = 0;
		int j = 0;
		int N[] = new int[n];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			N[i] = x;
		}
		for (int k = 0; k < n - 1; k++) {
			System.out.print (N[k] + " ");
			}
			System.out.println (N[n - 1]);
		for (int i = 1; i < n; i++) {
			v = N[i];
			j = i - 1;
			while (j >= 0 && N[j] > v) {
				N[j + 1] = N[j];
				j--;
				}
			N[j + 1] = v;
			for (int k = 0; k < n - 1; k++) {
				System.out.print (N[k] + " ");
				}
				System.out.println (N[n - 1]);
		}
	}
}
