# insertion_sort
N = gets.to_i
a = gets.split.map(&:to_i)

# N = 6
# a = [5,2,4,6,1,3]
#
# p N
# p a

def insertion_sort(n,a)
  for i in 1..(n-1)
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v
      a[j+1] = a[j]
      j -= 1
    end
    a[j+1] = v
    puts a.join(' ')
  end
end
insertion_sort(N,a)

