n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)

arr.each_with_index do |element, index|
  if index == 0
    puts arr.join(' ')
    next
  end
  v = element
  j = index - 1
  while(j >= 0 && arr[j] > v) do
    arr[j+1] = arr[j]
    j -= 1
  end
  arr[j + 1] = v
  puts arr.join(' ')
end

