def insertion_sort(arr)
  i = 1
  while i < arr.size
    puts arr.join(' ')
    i.downto(1) do |j|
      break if arr[j] >= arr[j - 1]

      arr[j], arr[j - 1] = arr[j - 1], arr[j]
    end

    i += 1
  end

  arr
end

def main
  _n = gets.to_i
  arr = gets.split.map(&:to_i)

  puts insertion_sort(arr).join(' ')
end

main

