#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vi in(n,-1);
		while(m--){
			char c;
			cin>>c;
			if(c=='s'){
				int a,b;
				cin>>a>>b;
				rep(i,n){
					bool h=true;
					loop(j,i,i+b)if(j>=n||in[j]!=-1)h=false;
					if(h){
						loop(j,i,i+b)in[j]=a;
						cout<<i<<endl;
						goto end;
					}
				}
				cout<<"impossible"<<endl;
				end:;
			}else{
				int a;
				cin>>a;
				rep(i,n)if(in[i]==a)in[i]=-1;
			}
		}
		cout<<"END"<<endl;
	}
}