# a = [13,19,9,5,12,8,7,4,21,2,6,11]
gets
a=gets.split(' ').map(&:to_i)
def ins(a)
  for i in 1..a.length-1
    c = 0
    s=""
    a.each do |b|
      s += "#{b}"
      s += " " if c != a.length-1
      c += 1
    end
    puts s
    v = a[i]
    while i >= 1 && a[i-1] > v
      a[i] = a[i-1]
      i -= 1
    end
    a[i] = v
  end
end
ins(a)
s=""
    c = 0

    a.each do |b|
      s += "#{b}"
      s += " " if c != a.length-1
      c += 1
    end
    puts s