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

puts a.join(" ")

for j in 1...n
  key = a[j]
  i = j - 1
  while i >= 0 and a[i] > key
    a[i+1] = a[i]
    i -= 1
  end
  a[i+1] = key
  puts a.join(" ")
end