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

for i in 1...n
  puts a.join(" ")
  v = a[i]  # 2[1]
  j = i - 1 # 0
  while j>=0 && a[j]> v # 5[0]>1[1]
    a[j+1]=a[j] # 2[1]=0[0]
    j -= 1      # 0
    a[j+1] = v  # a[1]=2[1]
  end
end

puts a.join(" ")
