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

print a.join(" "), "\n"
(1..(n-1)).each do |i|
	key = a[i]
	j = i
	while (j-=1) >= 0 && a[j] > key do
		a[j+1] = a[j]
	end
	a[j+1] = key
	print a.join(" "), "\n"
end