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

a.each.with_index do |key, i|
  next if i.zero?
  j = i - 1
  while j >= 0 && a[j] > key
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = key
  puts a.join(' ')
end