def insertion_sort a
  i = 1
  while i < a.size
    key = a[i]
    j = i - 1
    while j >= 0 and a[j] > key
      a[j + 1] = a[j]
      j -= 1
    end
    a[j + 1] = key
    i += 1
    puts a.join(' ')
  end
end

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

insertion_sort a