import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        TreeSet<Integer> p =new TreeSet<>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if(a==1){
                if(!p.contains(b)){
                    p.add(b);
                }else{
                    System.out.println("Already Exist");
                }
            }else if(a==2){
                if(!p.isEmpty()){
                    Integer c=p.floor(b);
                    Integer d=p.higher(b);
                    if (c == null) { 
                        p.remove(d);
                        System.out.println(d);
                        } else if (d == null) { 
                            p.remove(c);
                            System.out.println(c);
                            }else if((b-c)<(d-b)){
                        p.remove(c);
                        System.out.println(c);
                    }else if((b-c)>(d-b)){
                        p.remove(d);
                        System.out.println(d);
                    }else if ((b - c) == (d - b)) { 
                        p.remove(c);
                        System.out.println(c);
                        }
                }else{
                    System.out.println("Empty");
                }
            }
        }
    }
}