#include<bits/stdc++.h>
using namespace std;
long long n,op,s;
set <long long> st;
int main(){
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld %lld",&op,&s);
if(op==1){
long long w=st.size();
st.insert(s);
if(st.size()==w) printf("Already Exist\n");
}
else{
if(st.empty()){
printf("Empty\n");
continue;
}
auto B=st.lower_bound(s),E=prev(st.lower_bound(s));
if(abs(s-(*B))<abs(s-(*E))) cout<<(*B)<<endl,st.erase((*B));
else cout<<(*E)<<endl,st.erase((*E));
}
}
return 0;
}