#!/usr/bin/ruby
#
# 1035.rb: Sleeping Cats
#

### main

loop do
  w, q = gets.split.map(&:to_i)
  break if w == 0 && q == 0

  fence = [false] * w
  cats = []
 
  q.times do
    op, id, wc = gets.split
    id = id.to_i
    #p [op, id, wc]

    case op
    when 's'
      wc = wc.to_i
      ng = true

      for b in (0..(w - wc))
        if fence[b, wc].select{|f| f}.length == 0
          ng = false
          break
        end
      end

      if ng
        puts 'impossible'
      else
        fence[b, wc] = [true] * wc
        cats[id] = [b, wc]
        puts b
      end
    when 'w'
      b, wc = cats[id]
      fence[b, wc] = [false] * wc
      cats[id] = nil
    end
    #p fence
    #p cats
  end

  puts 'END'
end