Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: 

  * add x y — on the sheet of paper Bob marks a point with coordinates (x, y). For each request of this type it's guaranteed that point (x, y) is not yet marked on Bob's sheet at the time of the request. 
  * remove x y — on the sheet of paper Bob erases the previously marked point with coordinates (x, y). For each request of this type it's guaranteed that point (x, y) is already marked on Bob's sheet at the time of the request. 
  * find x y — on the sheet of paper Bob finds all the marked points, lying strictly above and strictly to the right of point (x, y). Among these points Bob chooses the leftmost one, if it is not unique, he chooses the bottommost one, and gives its coordinates to Pete. 



Bob managed to answer the requests, when they were 10, 100 or 1000, but when their amount grew up to 2·105, Bob failed to cope. Now he needs a program that will answer all Pete's requests. Help Bob, please!

Input

The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are non-negative and don't exceed 109.

Output

For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1.

Examples

Input

7
add 1 1
add 3 4
find 0 0
remove 1 1
find 0 0
add 1 1
find 0 0


Output

1 1
3 4
1 1


Input

13
add 5 5
add 5 6
add 5 7
add 6 5
add 6 6
add 6 7
add 7 5
add 7 6
add 7 7
find 6 6
remove 7 7
find 6 6
find 4 4


Output

7 7
-1
5 5
import java.util.*;
import java.io.*;

public class CF19D_3{ 
  public static Node [] segTree;
  public static NavigableSet<Integer>[] set;
  public static void main(String[] args)throws Exception {
    InputReader in = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    
    int n = in.nextInt();
    //HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
    //HashMap<Integer, Integer> originalX = new HashMap<Integer, Integer>();
    //TreeSet<Integer> orderedX = new TreeSet<Integer>();
    
    //Node [] queries = new Node[n];
    
    int type[] = new int[n], xx[] = new int[n], yy[] = new int[n];
    
    for(int i = 0; i < n; i++){
      char s = in.next().charAt(0);
      int x = in.nextInt(), y = in.nextInt();
      if(s == 'a') type[i] = 1;
      else if(s == 'r') type[i] = 2;
      else type[i] = 3;
      
      xx[i] = x; yy[i] = y;
      //orderedX.add(x);
    }
    /*
    int idx = 1;
    for(int i : orderedX){
      map.put(i, idx);
      originalX.put(idx, i);
      idx++;
    }*/
    
    Hash map = new Hash(n, xx);
    
    int p = 1, s = 1, e = map.size();
    
    segTree = new Node[700000];
    for(int i = 0; i < 700000; i++){
      segTree[i] = new Node(0, 0);
    }
    
    
    
    /*
    int p = 1, s = 1, e = 8;
    update(p, s, e, 5, 6);
    update(p, s, e, 3, 5);
    update(p, s, e, 4, 6);
    update(p, s, e, 2, 6);
    pw.println(BS(5, 2, s, e));
    */
    
    
    set = new TreeSet[e+1];
    
    for(int i = 0; i<= e; i++){
      set[i] = new TreeSet<Integer>();
    }
    
    for(int i = 0; i < n; i++){
      int x = xx[i], y = yy[i];
      x = map.get(x);
 
      if(type[i] == 1){
        set[x].add(y);
        int highestY = set[x].last();
        update(p, s, e, x, highestY);
      }
      else if(type[i] == 2){
        set[x].remove(y);
        int highestY = 0;
        if(!set[x].isEmpty()) highestY = set[x].last();
        update(p, s, e, x, highestY);
      }
      
      else{
        //int ansX = BS(x, y, s, e);
        int ansX = query(p, s, e, x, y);
        //int ansX = ask(x+1, y, p, s, e);
        if(ansX == -1){
          pw.println(-1);
        }
        else{
          int ansY = set[ansX].higher(y);
          ansX = map.value(ansX);
          pw.println(ansX+" "+ansY);
        }
      }
      
    }
    
    pw.close();
  }
  
  static int ask(int i, int c, int t, int l, int r) {
    if (segTree[t].x <= c || i > r)
      return -1;
    if (l == r)
      return segTree[t].x > c ? l : -1;
    int mid = (l + r) >> 1;
    if (i > mid)
      return ask(i, c, t << 1 | 1, mid + 1, r);
    else {
      int res = ask(i, c, t << 1, l, mid);
      if (res != -1)
        return res;
      else
        return ask(i, c, t << 1 | 1, mid + 1, r);
    }
    
  }
  
  /*
  static int BS(int x, int y, int s, int e){
    int lo  = x+1, hi = e, mid = (lo+hi)/2;
    int temp = 0;
    while(lo < hi){
      mid = (lo+hi)/2;
      temp = query(1, s, e, x+1, mid).x;
      if( temp > y) hi = mid;
      else lo = mid+1;
    }
    //System.err.println(lo);
    if(lo > e || query(1, s, e, x+1, lo).x <= y) return -1;
    return lo; //returns the lowest index where arr[lo] >= num;
  }
  
  static Node query(int p, int s, int e, int l, int r){
    if(s >= l && e <= r) return segTree[p];
    if(s > r || e < l) return null;
    int m = (s+e)/2, left = 2*p, right = 2*p+1;
    Node q1 = query(left, s, m, l, r), q2 = query(right, m+1, e, l, r);
    if(q1 == null) return q2;
    if(q2 == null) return q1;
    if(q2.x > q1.x) return q2;
    else return q1;
  }
  */
  
  
  static void update(int p, int s, int e, int pos, int val){
    if(s == e && s == pos){
      segTree[p].x = val;
      segTree[p].idx = pos;
      return;
    }
    if(s > pos || e < pos) return;
    
    int m = (s+e)/2, left = 2*p, right = 2*p+1;
    update(left, s, m, pos, val);
    update(right, m+1, e, pos, val);
    
    if(segTree[right].x > segTree[left].x){
      segTree[p].x = segTree[right].x;
      segTree[p].idx = segTree[right].idx;
    }
    else{
      segTree[p].x = segTree[left].x;
      segTree[p].idx = segTree[left].idx;
    }
  }
  
  static int query(int p, int s, int e, int x, int y){
    //System.err.println(s+" "+e+"   "+segTree[p].x+" "+y);
    if(segTree[p].x <= y || e <= x) return -1;
    if(s == e){
      if(segTree[p].x <= y || s <= x) return -1;
      else return s;
    }
    
    int m = (s+e)/2, left = 2*p, right = 2*p+1;
    if(segTree[left].x > y && m > x){
      int q1 = query(left, s, m, x, y);
      if(q1 != -1) return q1;
      return query(right, m+1, e, x, y);
      
    }
    else return query(right, m+1, e, x, y);
    
  }
    
  static class Node{
    public int idx, x, y;
    public Node(int i, int xx, int yy){
      idx = i; x = xx; y = yy;
    }
    public Node(int i, int xx){
      idx = i;  x = xx;
    }
    public String toString(){
      return idx+" "+x+" "+y;
    }
  }
  
  static class Hash {
    public int size, array[];
    
    Hash(int length, int[] array) {
      Set<Integer> treeset = new TreeSet<Integer>();
      for (int i = 0; i < length; i++) {
        treeset.add(array[i]);
      }
      this.array = new int[treeset.size()];
      size = 0;
      for (int i : treeset)
        this.array[size++] = i;
    }
    int size() {
      return size;
    }
    
    int length() {
      return size;
    }
    
    int get(int key) {
      return Arrays.binarySearch(array, key);
    }
    
    int value(int idx) {
      return array[idx];
    }
    
    
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;
    
    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }
    
    public String next()throws Exception {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
        tokenizer = new StringTokenizer(reader.readLine());
      return tokenizer.nextToken();
    }
    
    public String nextLine()throws Exception {
      String line = null;
      tokenizer = null;
      line =  reader.readLine();
      return line;
    }
    
    public int nextInt()throws Exception {
      return Integer.parseInt(next());
    }
    
    public double nextDouble() throws Exception{
      return Double.parseDouble(next());
    }
    
    public long nextLong()throws Exception {
      return Long.parseLong(next());
    }
    
  }
}
	 	 			      					 			  		   		