def show_ary(n,a)
	(n-1).times do |i|
		print a[i]
		print " "
	end
	print a[n-1]
	print "\n"
end

num = gets.to_i
num -= 1
a = gets.split(" ").map{|item| item.to_i}
show_ary(num+1,a)
num.times do |i|
	v = a[i+1]
	j = i
	if a[j] > v
		while j >= 0 && a[j] > v do
			a[j+1] = a[j]
			j -= 1
			a[j+1] = v
		end
		show_ary(num+1,a)
	elsif
		show_ary(num+1,a)
	end
end

