def insertionSort(as)
  puts as.join(' ')
  i = 1
  while i < as.size do
    a = as[i]
    j = i - 1
    while j >= 0 do
      sorted = as[j]
      if sorted > a
        as[j] = a
        as[j+1] = sorted
        j = j - 1
      else
        j = -1
      end
    end
    puts as.join(' ')
    i = i + 1
  end
end

n = STDIN.gets.to_i
as = STDIN.gets.split(' ').map { |x| x.to_i }
insertionSort(as)

