#include<bits/stdc++.h>
using namespace std;
set<int> S;
set<int>::iterator i,j;
int main()
{
int n;
cin>>n;
for(int l=1;l<=n;l++)
{
int op,length;
cin>>op>>length;
if(op==1)
S.insert(length);
if(op==2)
{
if(S.empty())
cout<<"Empty"<<endl;
else if(S.count(length))
{
cout<<length<<endl;
S.erase(length);
}
else
{
i=S.lower_bound(length);
j=i;
if(j!=S.begin())
j--;
if(i!=S.end()&&length-(*j)>(*i)-length)
j=i;
cout<<(*j)<<endl;
S.erase(j);
}
}
}
return 0;
}