n = gets.strip.to_i

arr = gets.strip.split(' ').map(&:to_i)
arr.length.times do |i|
  next if i == 0
  puts arr.join(' ')
  e = arr[i]
  j = i - 1
  while 0 <= j && e < arr[j]
    arr[j+1] = arr[j]
    arr[j] = e
    j -= 1
  end
end
puts arr.join(' ')