import java.util.Scanner;

public class Main {
	void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	}
	
	void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	}
	
	void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	} run {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int[] array = new int[1000]; array new int[1000] 1000 int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array[i] = scan.nextInt();
		} {
			array[i] = scan.nextInt();
		} array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		} {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		} this.printArray(array, n) this.printArray this array n if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			} array[i] < array[i-1] array[i] array i array[i-1] array i-1 i 1 {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			} for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				} int j = i; int j = i; j i j > 0 j 0 j-- j-- j {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				} {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				} if(array[j] >= array[j-1]) break; array[j] >= array[j-1] array[j] array j array[j-1] array j-1 j 1 break; int tmp = array[j]; tmp array[j] array j array[j] = array[j-1] array[j] array j array[j-1] array j-1 j 1 array[j-1] = tmp array[j-1] array j-1 j 1 tmp this.printArray(array, n) this.printArray this array n void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	} printArray {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	} for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		} {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		} System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if(i == n-1) System.out.println();
			else System.out.print(" "); i == n-1 i n-1 n 1 System.out.println() System.out.println System.out System System.out System.out.print(" ") System.out.print System.out System System.out " " int[] array array int n n public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	}
	
	void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	}
	
	void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

public class Main {
	void run() {
		// 入力
		Scanner scan = new Scanner(System.in);
		int[] array = new int[1000];
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			array[i] = scan.nextInt();
		}
		// ソート
		for(int i = 1; i < n; i++) {
			this.printArray(array, n);
			if(array[i] < array[i-1]) {
				for(int j = i; j > 0; j--) {
					if(array[j] >= array[j-1]) break;
					int tmp = array[j];
					array[j] = array[j-1];
					array[j-1] = tmp;
				}
			}
		}
		this.printArray(array, n);
	}
	
	void printArray(int[] array, int n) {
		for(int i = 0; i < n; i++) {
			System.out.print(array[i]);
			if(i == n-1) System.out.println();
			else System.out.print(" ");
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}
