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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;


public class Main
{
	static int tree[],sz[];
	static TreeSet<Integer>[] p;
	static void add(int l,int r,int k,int x)
	{
		if (l==r)
		{
			tree[k]=p[x].size()==0 ? -1 : p[l].last();//如果该x轴不存在坐标，写为-1，否则取set中最大的y
			return;
		}
		int m=(l+r)>>1;
		if (x<=m)add(l,m,k<<1,x);
		else add(m+1,r,k<<1|1,x);
		tree[k]=Math.max(tree[k<<1], tree[k<<1|1]);
	}
	static int find(int l,int r,int k,int a,int b,int value)
	{
		if (tree[k]<=value || a>b)return -1;//a可能会大于b，仔细思考一下就知道
		if (l==r)return l;//返还索引
		int m=(l+r)>>1;
		int t=-1;
		if (a<=m)t=find(l,m,k<<1,a,b,value);
		if (t!=-1)return t;//如果你左边这块区间已经找到了，那么就不用搜右边了，因为最符合要求的x一定在左边
		return find(m+1,r,k<<1|1,a,b,value);//不然就向右查找
	}
	static int fen(int value)//二分查找该值在sz[]中的下标
	{
		int l=1,r=o;
		while (l<r)
		{
			int m=(l+r)>>1;
			if (sz[m]>=value)
			{
				r=m;
			}
			else l=m+1;
		}
		return l;
	}
	static int o;
	public static void main(String[] args) throws IOException
	{
		Scanner sc=new Scanner(System.in);
		int n=ini();
		String s[]=new String [n+1];
		int x[]=new int [n+1];
		int y[]=new int [n+1];
		TreeSet<Integer> set=new TreeSet<>();
		sz=new int [n+1];
		o=0;
		for (int i=1;i<=n;i++)
		{
			s[i]=ins();
			x[i]=ini();
			y[i]=ini();
			set.add(x[i]);
		}
		for (Integer w:set)
		{
			sz[++o]=w;
		}//对x去重+离散，存入sz[]
		p=new TreeSet [o+1];//存每个x轴中的所有坐标的y点
		for (int i=1;i<=o;i++)
		{
			p[i]=new TreeSet<Integer>();
		}
		tree=new int [o<<2];
		Arrays.fill(tree, -1);//初始化全没有
		for (int i=1;i<=n;i++)
		{
			int l=fen(x[i]);//该x在sz[]中的索引
			if (s[i].equals("add"))
			{
				p[l].add(y[i]);//该x轴中添加y
				add(1,o,1,l);//维护一遍线段树
			}
			else if (s[i].equals("remove"))
			{
				p[l].remove(y[i]);
				add(1,o,1,l);
			}
			else
			{
				int q=find(1,o,1,l+1,o,y[i]);//查找符合要求的最小的x下标，不存在输出-1;
				if (q==-1)
				{
					out.println(-1);
					continue;
				}
				out.print(sz[q]+" ");
				for (Integer w:p[q])//遍历q轴所有的y，找到最符合要求的一个
				{
					if (w>y[i])
					{
						out.println(w);
						break;
					}
				}
				
			}
		}
		
		
		out.flush();
	}

/*

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

*/
	
	static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static int ini() throws IOException
	{
		in.nextToken();
		return (int)in.nval;
	}
	static String ins() throws IOException
	{
		in.nextToken();
		return in.sval;
	}
}
