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);
	}

}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz