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.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeMap;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD_Points solver = new TaskD_Points();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD_Points {

    TreeMap<Integer, Integer>[] yToX;
    private SegmentTree tree;
    private CompressData compressData;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        Query[] queries = new Query[n];
        compressData = new CompressData();
        for (int i = 0; i < n; ++i) {
            queries[i] = new Query(in.nextString(), in.nextInt(), in.nextInt());
            compressData.add(queries[i].x);
        }
        compressData.build();
        for (Query q : queries) {
            q.x = compressData.originalToMapping(q.x);
        }
        tree = new SegmentTree(compressData.getSize());
        yToX = new TreeMap[compressData.getSize()];
        for (int i = 0; i < compressData.getSize(); ++i) {
            yToX[i] = new TreeMap<Integer, Integer>();
        }
        for (Query q : queries) {
            if (q.type == TYPE.ADD) {
                addPoint(q.x, q.y);
            } else if (q.type == TYPE.REMOVE) {
                removePoint(q.x, q.y);
            } else {
                findPoint(out, q.x, q.y);
            }
        }
    }

    class SegmentTree {
        int[] max;
        int maxRight;
        int maxTree;

        SegmentTree(int size) {
            maxTree = 1;
            while (maxTree <= size) maxTree <<= 1;
            maxRight = maxTree - 1;
            maxTree <<= 1;
            max = new int[maxTree];
        }

        void set(int x, int y) {
            int v = maxRight + 1 + x;
            max[v] = y;
            v >>= 1;
            while (v > 0) {
                max[v] = Math.max(max[v * 2], max[v * 2 + 1]);
                v >>= 1;
            }
        }

        Integer getX(int x, int y) {
            int t = get(1, 0, maxRight, x, y);
            if (t == -1) return null;
            return t;
        }

        private int get(int v, int rangeLeft, int rangeRight, int left, int y) {
            if (rangeLeft == rangeRight) {
                if (max[v] <= y) {
                    return -1;
                }
                return v - maxRight - 1;
            }
            int middle = (rangeLeft + rangeRight) / 2;
            if (max[v] <= y) {
                return -1;
            }
            if (left <= middle) {
                int res = get(2 * v, rangeLeft, middle, left, y);
                if (res != -1) return res;
            }
            return get(2 * v + 1, middle + 1, rangeRight, left, y);
        }
    }

    private void findPoint(PrintWriter out, int x, int y) {
        Integer nx = tree.getX(x + 1, y);
        if (nx == null) {
            out.println(-1);
        } else {
            int ny = yToX[nx.intValue()].higherKey(y);
            out.println(compressData.mappingToOriginal(nx.intValue()) + " " + ny);
        }
    }

    private void addPoint(int x, int y) {
        Integer max = getMaxY(x);
        if (max == null || max < y) {
            tree.set(x, y);
        }
        addToMap(x, y);
    }

    private void addToMap(int x, int y) {
        if (yToX[x].containsKey(y)) {
            yToX[x].put(y, yToX[x].get(y) + 1);
        } else {
            yToX[x].put(y, 1);
        }
    }

    private void removeToMap(int x, int y) {
        if (yToX[x].get(y) == 1) {
            yToX[x].remove(y);
        } else {
            yToX[x].put(y, yToX[x].get(y) - 1);
        }
    }

    private Integer getMaxY(int x) {
        if (yToX[x].isEmpty()) return null;
        return yToX[x].lastKey();
    }

    private void removePoint(int x, int y) {
        Integer max = getMaxY(x);
        if (max == y) {
            removeToMap(x, y);
            Integer ny = getMaxY(x);
            if (ny != null) {
                tree.set(x, ny.intValue());
            } else {
                tree.set(x, 0);
            }
        } else {
            removeToMap(x, y);
        }
    }

    enum TYPE {
        ADD,
        REMOVE,
        ASK
    }

    class Query {
        TYPE type;
        int x, y;

        Query(String s, int x, int y) {
            this.type = toType(s);
            this.x = x;
            this.y = y;
        }

        private TYPE toType(String s) {
            if (s.charAt(0) == 'a') {
                return TYPE.ADD;
            } else if (s.charAt(0) == 'r') {
                return TYPE.REMOVE;
            } else {
                return TYPE.ASK;
            }
        }
    }
}

class CompressData {
    List<Integer> x;

    public CompressData(List<Integer> x) {
        this.x = x;
        CollectionUtils.unique(this.x);
    }

    public CompressData() {
        this.x = new ArrayList<Integer>();
    }

    public int getSize() {
        return this.x.size();
    }

    public void add(int x) {
        this.x.add(x);
    }

    public void build() {
        CollectionUtils.unique(this.x);
    }

    public int originalToMapping(int original) {
        return Collections.binarySearch(x, original);
    }

    public int mappingToOriginal(int id) {
        return x.get(id);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

class CollectionUtils {

    //    public static List<Double> unique(List<Double> a) {
//        List<Double> result = new ArrayList<Double>();
//        result.add(a.get(0));
//        int last = 0;
//        for (int i = 1; i < a.size(); ++i) {
//            if (DoubleUtils.compareTo(a.get(i), result.get(last)) != 0) {
//                result.add(a.get(i));
//                ++last;
//            }
//        }
//        return result;
//    }

    public static void unique(List<Integer> a) {
        Collections.sort(a);
        int size = 1;
        for (int i = 1; i < a.size(); i++) {
            if (!a.get(i).equals(a.get(size - 1))) {
                a.set(size++, a.get(i));
            }
        }
        for (int i = a.size() - 1; i >= size; i--) {
            a.remove(i);
        }
    }

//    public static void unique(List<Long> a) {
//        Collections.sort(a);
//        int size = 1;
//        for (int i = 1; i < a.size(); i++) {
//            if (!a.get(i).equals(a.get(size - 1))) {
//                a.set(size++, a.get(i));
//            }
//        }
//        for (int i = a.size() - 1; i >= size; i--) {
//            a.remove(i);
//        }
//    }

}

