num = gets.to_i
num -= 1
a = gets.split(" ").map{|item| item.to_i}
a.each{|item| print "#{item} "}
print "\n"
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
		a.each{|item| print "#{item} "}
		print "\n"
	elsif
		a.each{|item| print "#{item} "}
		print "\n"
	end
end

