N = STDIN.gets.to_i
A = STDIN.gets.split(' ').map(&:to_i)

def insersion_sort(n, a)
  puts a.join(' ')
  (1..n-1).each do |i|
    v = a[i]
    j = i - 1
    while j >= 0 && a[j] > v
      a[j+1] = a[j]
      j = j - 1
    end
    a[j+1] = v
    puts a.join(' ')
  end
end

insersion_sort(N, A)

