def trace(a)
  n = a.length
  i = 0
  while i < n do
    print " " if i > 0
    print "#{a[i]}"
    i += 1
  end
  puts ""
end

def insertion_sort(a)
  n = a.length
  i = 1
  while i < n do
    v = a[i]
    j = i - 1
    while j >= 0 && a[j] > v do
      a[j + 1] = a[j]
      j -= 1
    end
    a[j + 1] = v
    trace(a)
    i += 1
  end
end

n = gets.to_i
a = gets.split.map(&:to_i)

trace(a)
insertion_sort(a)

