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

(1..cards.size-1).each do |i|
  puts cards.join(' ')
  c = cards[i]
  j = i - 1
  while(j >= 0 and cards[j] > c)
    cards[j + 1] = cards[j]
    j-=1
  end
  cards[j + 1] = c
end

puts cards.join(' ')
