import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	}

	public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	}
	
	public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	}
	
	public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	}

	public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	}
	
	public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	}
	
	public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	}

} Main public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int len = Integer.parseInt(br.readLine()); len Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " "); tokenizer new StringTokenizer(br.readLine(), " ") int[] arr = new int[len]; arr new int[len] len int i = 0; i 0 while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		} tokenizer.hasMoreElements() tokenizer.hasMoreElements tokenizer {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		} arr[i++] = Integer.parseInt((String) tokenizer.nextElement()) arr[i++] arr i++ i Integer.parseInt((String) tokenizer.nextElement()) Integer.parseInt Integer (String) tokenizer.nextElement() tokenizer.nextElement tokenizer sort(arr) sort arr String[] args args public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	} sort {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	} printArr(arr) printArr arr for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		} int i = 1; int i = 1; i 1 i < arr.length i arr.length arr arr.length i++ i++ i {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		} {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		} for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			} int j = i; int j = i; j i j >= 1 j 1 j-- j-- j {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			} {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			} int current = arr[j]; current arr[j] arr j int prev = arr[j - 1]; prev arr[j - 1] arr j - 1 j 1 if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				} current < prev current prev {
					swap(arr, j - 1, j);
				} swap(arr, j - 1, j) swap arr j - 1 j 1 j {
					break;
				} break; printArr(arr) printArr arr int[] arr arr public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	} swap {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	} int temp = arr[from]; temp arr[from] arr from arr[from] = arr[to] arr[from] arr from arr[to] arr to arr[to] = temp arr[to] arr to temp int[] arr arr int from from int to to public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	} printArr {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	} String msg = ""; msg "" for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		} {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		} msg += arr[i] msg arr[i] arr i if (i == arr.length - 1) {
				break;
			} i == arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 {
				break;
			} break; msg += " " msg " " System.out.println(msg) System.out.println System.out System System.out msg int[] arr arr public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	}

	public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	}
	
	public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	}
	
	public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	}

	public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	}
	
	public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	}
	
	public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int len = Integer.parseInt(br.readLine());
		StringTokenizer tokenizer = new StringTokenizer(br.readLine(), " ");

		int[] arr = new int[len];
		int i = 0;
		while (tokenizer.hasMoreElements()) {
			arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
		}

		sort(arr);
	}

	public static void sort(int[] arr) {
		printArr(arr);

		for (int i = 1; i < arr.length; i++) {
			for (int j = i; j >= 1; j--) {
				int current = arr[j];
				int prev = arr[j - 1];
				
				if (current < prev) {
					swap(arr, j - 1, j);
				} else {
					break;
				}
			}
			
			printArr(arr);
		}
	}
	
	public static void swap(int[] arr, int from, int to) {
		int temp = arr[from];
		arr[from] = arr[to];
		arr[to] = temp;
	}
	
	public static void printArr(int[] arr) {
		String msg = "";
		for (int i = 0; i < arr.length; i++) {
			msg += arr[i];
			if (i == arr.length - 1) {
				break;
			}
			msg += " ";
		}
		System.out.println(msg);
	}

}