def insertionsort(a, n)
	output = [a.join(" ")]

	1.upto(n-1) do |i|
		v = a[i]
		j = i-1
		
		while j >= 0 && v < a[j]
			a[j+1] = a[j]
			j -= 1
		end
		
		a[j+1] = v
		
		output.push(a.join(" "))
	end
	
	return output.join("\n")
end


N = gets.to_i
Arr = gets.split.map(&:to_i)

puts insertionsort(Arr, N)

