import sys, bisect
from collections import defaultdict

a, q, c = [], int(sys.stdin.readline().strip()), defaultdict(int)  # 设置列表a,输入值q,集合c
for _ in range(q):
    op, x = map(int, sys.stdin.readline().strip().split())  # 接下来q行,每行包含操作类型op和参数x
    if op == 1:  # 操作1
        if c[x]:  # 若x元素已存在
            print("Already Exist")
        else:  # 若x元素不存在
            bisect.insort(a, x)  # 将x插入a列表,并自动排序
            c[x] = 1  # 集合c中x的键值设置为1,表示x元素已存在
    elif op == 2:  # 操作2
        if not a:  # 若列表a为空
            print("Empty")
        else:  # 若列表a不为空
            i = bisect.bisect_left(a, x)  # 获取元素x在列表a中的索引值
            l = r = float("inf")  # 设置l和r的初始值为无穷大
            if 0 < i <= len(a):  # 防止列表a出现越界问题
                l = x - a[i - 1]  # 列表a中与元素x差值最小的元素的较小元素,差值为l
            if 0 <= i < len(a):  # 防止列表a出现越界问题
                r = a[i] - x  # 列表a中与元素x差值最小的元素的较大元素,差值为r
            if l > r:  # 若元素x与较大元素的差值>元素x与较小元素的差值
                c[a[i]] = 0  # 下一步删除较小差值,这一步对应索引的元素的键值归零,表示删除后不存在该元素了
                print(a.pop(i))  # 删除对应索引的元素
            else:
                c[a[i - 1]] = 0  # 下一步删除较小差值,这一步对应索引的元素的键值归零,表示删除后不存在该元素了
                print(a.pop(i - 1))  # 删除对应索引的元素