import sys
import bisect #使用二分法查找+有序列表
q = int(input())
s = []
for _ in range(q):
op , x = map(int,input().split())
if op == 1:
pos = bisect.bisect_left(s,x)
if pos < len(s) and s[pos] == x :
print('Already Exist')
else:
s.insert(pos,x)
elif op == 2:
if not s:
print("Empty")
else:
pos_left= bisect.bisect_left(s,x) #pos_left左边的元素都比x小
#根据pos_left位置分三种情况
if pos_left == 0 : #s中都>=x,输出第一个
print(s.pop(0))
elif pos_left < len(s) :
if x -s[pos_left-1] <= s[ pos_left] -x :
print(s.pop(pos_left-1))
else:
print(s.pop(pos_left))
elif pos_left == len(s) : #s中都比x小,输出最后一个
print(s.pop(-1))