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.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NavigableSet;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		new CF_19D().run();
	}
}

class CF_19D {
	void run() {
	//	Scanner cin = new Scanner(new BufferedInputStream(System.in));
	//	FastScanner cin = new FastScanner(System.in) ;
		InputReader cin = new InputReader(System.in) ;
		PrintWriter cout = new PrintWriter(new BufferedOutputStream(System.out));
		int n = cin.nextInt();
		for (int i = 0; i < n; i++) {
			switch (cin.next()) {
			case "add":
				operator[i] = 0;
				break;
			case "remove":
				operator[i] = 1;
				break;
			case "find":
				operator[i] = 2;
				break;
			}
			x[i] = cin.nextInt();
			y[i] = cin.nextInt();
		}
		Hash h = new Hash(n, x);
		int limit = h.length() - 1;
		for (int i = 0; i <= limit; i++)
			set[i].clear();

		buildTree(1, 0, limit);
		for (int i = 0; i < n; i++) {
			int id = h.idx(x[i]);
			if (operator[i] == 0) {
				set[id].add(y[i]);
				update(id, set[id].isEmpty() ? 0 : set[id].last(), 1, 0, limit);
			} else if (operator[i] == 1) {
				set[id].remove(y[i]);
				update(id, set[id].isEmpty() ? 0 : set[id].last(), 1, 0, limit);
			} else {
				int pos = ask(id + 1, y[i], 1, 0, limit);
				if (pos == NOTFIND)
					cout.println(NOTFIND);
				else
					cout.println(h.value(pos) + " " + set[pos].higher(y[i]));
			}
		}

		cout.flush();
	}

	void buildTree(int t, int l, int r) {
		left[t] = l;
		right[t] = r;
		max[t] = 0;
		if (l == r)
			return;
		int mid = (l + r) >> 1;
		buildTree(t << 1, l, mid);
		buildTree(t << 1 | 1, mid + 1, r);
		up(t);
	}

	void update(int i, int c, int t, int l, int r) {
		if (l > r)
			return;
		if (l == r) {
			max[t] = c;
			return;
		}
		int mid = (l + r) >> 1;
		if (i <= mid)
			update(i, c, t << 1, l, mid);
		else
			update(i, c, t << 1 | 1, mid + 1, r);
		up(t);
	}

	int ask(int i, int c, int t, int l, int r) {
		if (max[t] <= c || i > r)
			return NOTFIND;
		if (l == r)
			return max[t] > c ? l : NOTFIND;
		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 != NOTFIND)
				return res;
			else
				return ask(i, c, t << 1 | 1, mid + 1, r);
		}

	}

	void up(int t) {
		max[t] = Math.max(max[t << 1], max[t << 1 | 1]);
	}

	final int NOTFIND = -1;
	final int N = 200_008;
	int[] x = new int[N];
	int[] y = new int[N];
	int[] z = new int[N];
	int[] operator = new int[N];
	NavigableSet<Integer>[] set = new TreeSet[N];
	{
		for (int i = 0; i < N; i++)
			set[i] = new TreeSet<Integer>();
	}

	int[] left = new int[N << 2];
	int[] right = new int[N << 2];
	int[] max = new int[N << 2];

}

class Hash {
	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 length() {
		return size;
	}

	int idx(int key) {
		return Arrays.binarySearch(array, key);
	}

	int value(int idx) {
		return array[idx];
	}

	int size;
	int[] array;
}

class FastScanner extends BufferedReader {

	boolean isEOF;

	public FastScanner(InputStream is) {
		super(new InputStreamReader(is));
	}

	public int read() {
		try {
			int ret = super.read();
			if (isEOF && ret < 0) {
				throw new InputMismatchException();
			}
			isEOF = ret == -1;
			return ret;
		} catch (IOException e) {
			throw new InputMismatchException();
		}
	}

	public String next() {
		StringBuilder sb = new StringBuilder();
		int c = read();
		while (isWhiteSpace(c)) {
			c = read();
		}
		while (!isWhiteSpace(c)) {
			sb.appendCodePoint(c);
			c = read();
		}
		return sb.toString();
	}

	static boolean isWhiteSpace(int c) {
		return c >= -1 && c <= 32;
	}

	public int nextInt() {
		int c = read();
		while (isWhiteSpace(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int ret = 0;
		while (!isWhiteSpace(c)) {
			if (c < '0' || c > '9') {
				throw new NumberFormatException("digit expected " + (char) c
						+ " found");
			}
			ret = ret * 10 + c - '0';
			c = read();
		}
		return ret * sgn;
	}

}


class InputReader{
    public BufferedReader  reader;
    public StringTokenizer  tokenizer;

    public InputReader(InputStream stream){
                reader = new BufferedReader(new InputStreamReader(stream), 32768) ;
                tokenizer = null ;
    }

    public String next(){
                while(tokenizer == null || ! tokenizer.hasMoreTokens()){
                    try{
                            tokenizer = new StringTokenizer(reader.readLine());
                    }catch (IOException e) {
                            throw new RuntimeException(e);
                    }
                }
                return tokenizer.nextToken();  
    }

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

    public long nextLong() {
                return Long.parseLong(next());
    }

}