def insertion_sort(a, n)
  puts a.join(' ')

  for i in 1...n
    v = a[i]
    j = i-1
    while 0 <= j && v < a[j]
      a[j+1] = a[j]
      j -= 1
    end
    a[j+1] = v
    puts a.join(' ')
  end
end

n = gets.to_i
a = gets.split

insertion_sort(a, n)