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