n = gets.to_i
array = gets.chomp.split.map(&:to_i)
puts array.join(' ')

(1...n).each do |i|
  key = array[i]
  j = i - 1
  while j >= 0 && array[j] > key do
    array[j + 1] = array[j]
    j -= 1
  end
  array[j + 1] = key
  puts array.join(' ')
end
