def insertion_sort(array, n)
  1.upto(n-1) do |i|
    current = array[i]
    j = i - 1

    while j >= 0 && array[j] > current
      array[j+1] = array[j]
      j -= 1
    end

    array[j+1] = current
    trace(array)
  end
end

def trace(array)
  puts array.join(' ')
end

n = $stdin.gets.chomp.to_i
array = $stdin.gets.chomp.split(' ').map(&:to_i)

trace(array)
insertion_sort(array, n)