class AOJ
  def initialize
    n = gets.chomp.to_i
    a = gets.chomp.split(' ').map(&:to_i)

    0.upto(n-1) do |i|
      j = i
      v = a[j]

      while j > 0 && v < a[j-1]
        j -= 1
      end

      a.delete_at(i)
      a.insert(j, v)

      puts a.join(' ')
    end
  end
end

AOJ.new