n = STDIN.gets.to_i
array = STDIN.gets.split.map(&:to_i)
puts array

for i in 1..(n-1) do
  v=array[i]
  j=i-1
    while j>=0 && array[j] > v
      array[j+1] = array[j]
      j--
    end
  array[j+1] = v
  puts array
end

puts array