def find_ins_pos(a, val)
  pos = 0
  while pos < a.size and a[pos] < val do
    pos += 1
  end
  pos
end

def insertion_sort(a)
  b = []
  a.size.times { |i|
    pos = find_ins_pos(b, a[i])
    b.insert(pos, a[i])
    puts (b + a[i+1..-1]).map{|x| x.to_s}.join(" ")
  }
  b
end


def main()
  gets
  a = gets.split.map{|x| x.to_i}
  insertion_sort(a)
end

main

