import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		// 標準入力から数列と整数N（数列の長さ）を読み込み
		int n = Integer.parseInt(scanner.nextLine());    // 数列の長さ
		String[] array = scanner.nextLine().split(" ");  // 数列
		
		// 初期状態の配列状態を出力
		System.out.println(String.join(" ", array));
		
		for (int i = 1; i < n; i++) {
			int v = Integer.parseInt(array[i]);
			int j = i - 1;
			while(j >= 0 && Integer.parseInt(array[j]) > v) {
				array[j + 1] = array[j];
				j--;
			}
			array[j + 1] = Integer.toString(v);
			
			// 途中経過の配列状態を出力
			System.out.println(String.join(" ", array));
		}
		
		scanner.close();
	}
}


/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