import java.util.Scanner;

public class Main{
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int length = Integer.parseInt(scan.nextLine());
		String[] numStrings = scan.nextLine().split(" ");
		int[] nums = new int[length];
		for(int i = 0; i < length; i++)
			nums[i] = Integer.parseInt(numStrings[i]);
		
		for(int n = 0; n < length; n++) {
			System.out.print(nums[n]);
			if(n < length - 1)
				System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < nums.length; i++) {
			int current = nums[i];
			
			int index = 0;
			while(current > nums[index] && index < i)
				index++;
			
			for(int n = i; n > index; n--)
				nums[n] = nums[n - 1];
			
			nums[index] = current;
		
			for(int n = 0; n < length; n++) {
				System.out.print(nums[n]);
				if(n < length - 1)
					System.out.print(" ");
			}
			System.out.println();
		}
	}
}


/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