#include<bits/stdc++.h>
using namespace std;
int read(){
int x=0;
bool flag=false;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-'){
flag=true;
}
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+(ch-'0');
ch=getchar();
}
return flag?-x:x;
}
set<int>st;
int m;
int main(){
m=read();
int op,len;
while(m--){
op=read(),len=read();
if(op==1){
if(st.count(len)){
cout<<"Already Exist\n";
}else{
st.insert(len);
}
}else{
if(st.empty()){
cout<<"Empty\n";
}else{
auto it=st.upper_bound(len);
it--;
cout<<*it<<"\n";
st.erase(it);
}
}
}
return 0;
}