import std.stdio;
import std.string;
import std.algorithm;
import std.conv;

void main()
{
	auto N = readln.split[0].to!int;
	int[] yamafuda = readln.split.to!(int[]);
	writeln(yamafuda.to!(string[]).join(" "));
	foreach(i; 1..N)
	{
		auto tefuda = yamafuda[i];
		auto j = i - 1;
		while(j>=0 && yamafuda[j]>tefuda)
		{
			yamafuda[j+1] = yamafuda[j];
			j--;
			yamafuda[j+1] = tefuda;
		}
		writeln(yamafuda.to!(string[]).join(" "));
	}
	
}
