n = gets.strip.to_i
array = gets.split.map(&:to_i)
puts array.join(" ")

for i in 1..n-1 do
key = array[i]
j = i

while j>0 && array[j-1] > key do
array[j] = array[j-1]
j -=1
end
array[j] = key
puts array.join(" ")
end