n = gets.to_i
cards = gets.chomp.split.map(&:to_i)
puts cards.join(" ")
for i in (1 .. n - 1)
    card = cards[i]
    j = i - 1    
    while j >= 0 && cards[j] > card
        cards[j + 1] = cards[j]
        j -= 1
    end
    cards[j + 1] = card
    puts cards.join(" ")
end