#include<bits/stdc++.h>
using namespace std;
int main()
{
map<int,int> m;
int n;
scanf("%d",&n);
while(n--)
{
int a,b;
scanf("%d%d",&a,&b);
if(a==1)
if(!m.count(b))
m[b]=1;
else printf("Already Exist\n");
else
{
if(m.empty()) cout<<"Empty"<<endl;
else if(m.count(b))
{
printf("%d\n",b);
m.erase(b);
}
else
{
m[b]=1;
auto t1 = m.find(b);
auto t2 = t1;
if(t2==m.begin())
{
t1++;
cout<<(t1->first)<<endl;
m.erase(t1);m.erase(t2);
}
else if(t2==m.end())
{
t1--;
cout<<(t1->first)<<endl;
m.erase(t2);m.erase(t1);
}
else
{
auto t3 = t2;
t3++;
t1--;
int r1 = t3->first - t2->first;
int r2 = t2->first - t1->first;
if(r1<r2)
{
cout<<t3->first<<endl;
m.erase(t3);m.erase(t2);
}
else if(r2<=r1)
{
cout<<t1->first<<endl;
m.erase(t1);m.erase(t2);
}
}
}
}
}
return 0;
}