#include<iostream>
#include<map>
using namespace std;
map<int,bool> m;
int n,maxn=-1;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
int t,length;
cin>>t>>length;
if(t==1){
if(m.count(length)==true){
cout<<"Already Exist"<<endl;
}else{
m[length]=true;
}
if(maxn<length){
maxn=length;
}
}else{
if(m.empty()){
cout<<"Empty"<<endl;
}else{
int j=length,k=length;
while(j>=0||k<=maxn){
if(m.count(j)==true){
cout<<j<<endl;
m.erase(j);
break;
}else if(m.count(k)==true){
cout<<k<<endl;
m.erase(k);
break;
}else{
if(j!=0) j--;
if(k!=maxn) k++;
}
}
}
}
}
return 0;
}
AC#1#2#3,TLE#4#5