import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	} main {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int length = input.nextInt(); length input.nextInt() input.nextInt input int[] intList = new int[length]; intList new int[length] length int k = 0; k 0 for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		} int i = 0; int i = 0; i 0 i < intList.length i intList.length intList intList.length i++ i++ i {
			intList[i] = input.nextInt();
		} {
			intList[i] = input.nextInt();
		} intList[i] = input.nextInt() intList[i] intList i input.nextInt() input.nextInt input for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		} int m = 0; int m = 0; m 0 m < intList.length - 1 m intList.length - 1 intList.length intList intList.length 1 m++ m++ m {
			System.out.print(intList[m] + " ");
		} {
			System.out.print(intList[m] + " ");
		} System.out.print(intList[m] + " ") System.out.print System.out System System.out intList[m] + " " intList[m] intList m " " System.out.println(intList[intList.length - 1]) System.out.println System.out System System.out intList[intList.length - 1] intList intList.length - 1 intList.length intList intList.length 1 for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		} int i = 1; int i = 1; i 1 i < intList.length i intList.length intList intList.length i++ i++ i {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		} {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		} int key = intList[i]; key intList[i] intList i int j = i - 1; j i - 1 i 1 while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			} j >= 0 && intList[j] > key j >= 0 j 0 intList[j] > key intList[j] intList j key {
				intList[j+1] = intList[j];
				j--;
			} intList[j+1] = intList[j] intList[j+1] intList j+1 j 1 intList[j] intList j j-- j intList[j+1] = key intList[j+1] intList j+1 j 1 key for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			} int m = 0; int m = 0; m 0 m < intList.length - 1 m intList.length - 1 intList.length intList intList.length 1 m++ m++ m {
				System.out.print(intList[m] + " ");
			} {
				System.out.print(intList[m] + " ");
			} System.out.print(intList[m] + " ") System.out.print System.out System System.out intList[m] + " " intList[m] intList m " " System.out.println(intList[intList.length - 1]) System.out.println System.out System System.out intList[intList.length - 1] intList intList.length - 1 intList.length intList intList.length 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
}
