n = gets.to_i
arr = gets.split.map(&:to_i)
puts arr.join(' ')
(1...arr.length).each do |i|
  key = arr[i]
  j = i - 1
  while j >= 0 and arr[j] > key do
    arr[j+1] = arr[j]
    j -= 1
  end
  arr[j+1] = key
  puts arr.join(' ')
end