n = gets.chomp.to_i

cards = gets.chomp.split(" ").map(&:to_i)

puts cards.join(" ")

for a in 1..(n-1) do
  cards[a]
  while true
    if a-1 == -1
      break
    end
    if cards[a] < cards[a-1]
      tmp = cards[a]
      cards[a] = cards[a-1]
      cards[a-1] = tmp
      a -= 1
    else
      break
    end
  end
  puts cards.join(" ")
end


