require 'enumerator'
loop do
  w,q = gets.split.map(&:to_i)
  break if (w|q) == 0
  wall = Array.new(w,nil)
  cat = Hash.new
  q.times do
    pre,id,width = gets.split
    id = id.to_i
    if pre == "s"
      width = width.to_i
      c=0
      flag = nil
      wall.each_cons(width) do |x|
        if x.join == ""
          flag =true
          break
        end
        c+=1
      end
      if flag
        cat[id]=[c,width]
        puts c
        wall[c,width]=[1]*width
      else puts "impossible"
      end
    else
      pos,width = cat[id]
      wall[pos,width]=[nil]*width
    end
  end
  puts "END"
end