def PrintArr(a)
	a.length.times { |i|
		print " " unless i == 0
		print a[i]
	}
	puts
end

n = gets.to_i
a = gets.chomp.split(" ").map &:to_i

for i in 0...n
	v = a[i]
	for j in 0..i
		break if v > a[i-(j+1)]
		a[i-j] = a[i-(j+1)]
	end
	a[i-j] = v
	PrintArr(a)
end