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.BufferedWriter;
import java.time.Year;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.TreeSet;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;

public class Main
{
	static InputStream inputStream = System.in;
	static OutputStream outputStream = System.out;
	static InputReader in = new InputReader(inputStream);
	static OutputWriter out = new OutputWriter(outputStream);
	static char f[];
	static int l[],r[],sz[];
	static TreeSet<Integer>[] p;
	static int cnt=0;
	//static int ymax[];
	static int tree[];
	public static void main(String[] args)
	{
		int n=in.readInt();
		f=new char[n+1];
		l=new int[n+1];
		r=new int[n+1];
		sz=new int[n+1];
		TreeSet<Integer>set=new TreeSet<>((o1, o2) -> (o1-o2));
		Map<Integer,Integer>map=new HashMap<>();
		Map<Integer,ArrayList<Integer>>smap=new HashMap<Integer,ArrayList<Integer>>();
	    for(int i=1;i<=n;i++)
	    {
	    	f[i]=in.readString().charAt(0);l[i]=in.readInt();r[i]=in.readInt();
	    	if(set.add(l[i]))
	    	{
	    		sz[++cnt]=l[i];	    		
	    	}
	    }
	    Arrays.sort(sz,1,cnt+1);
	    //System.out.println(Arrays.toString(sz)+" "+cnt);
		TreeSet<Integer>set2=new TreeSet<>((o1, o2) -> (o1-o2));
		p=new TreeSet [cnt+1];
		//ymax=new int[cnt+1];
		tree=new int[cnt<<2];
		Arrays.fill(tree,-1);
		for(int i=1;i<=cnt;i++)
		{
			p[i]=new TreeSet<Integer>();
		}
		for(int i=1;i<=n;i++)
		{			
			int left=erfen(l[i]);
			if(f[i]=='a')
			{
				p[left].add(r[i]);
				//ymax[left]=p[left].size()==0?-1:p[left].last();
				update(1,cnt,1,left);
			}
			else if(f[i]=='r')
			{
//				if(p[left].last()!=r[i]) 
//				{
//					p[left].remove(r[i]);
//					//ymax[left]=p[left].size()==0?-1:p[left].last();		
//				}else 
				{
					p[left].remove(r[i]);
					update(1,cnt,1,left);
				}
			}
			else
			{
				//bfs(1,n);
				//for(int j=1;j<=cnt<<2-1;j++)out.printLine(j+" ss"+tree[j]);;
				int flag=query(left+1,cnt,1,cnt,1,r[i]);
				if(flag==-1)
				{
					out.printLine(-1);
					continue;
				}
				out.print(sz[flag]+" ");
				for(Integer j:p[flag])
				{
					if(j>r[i])
					{
						out.printLine(j);
						break;
					}
				}
			}
		}	
		out.close();
	}
	static int erfen(int value)//二分查找该值在sz[]中的下标
	{
		int l=1,r=cnt;
		while (l<r)
		{
			int m=(l+r)>>1;
			if (sz[m]>=value)
			{
				r=m;
			}
			else l=m+1;
		}
		return l;
	}
/*	static int cha(int l,int r,int y)
	{
//		if(l==r)return (ymax[l]>y?l:-1); 
//		int mid=(1+r)>>1;
//		
//		int left=cha(l, mid, y);
//		int right=cha(mid+1, r, y);
//		if(ymax[left]>y && ymax[right]>y)return left;
//		if(left==-1 && right==-1)return -1;
//		if(left==-1 && ymax[right]>y)return right;
//		if(right==-1&& ymax[left]>y)return left;
//		return -1;
		for(int i=l;i<=r;i++)
		{
			if(ymax[i]>y)
			{
				return i;
			}
		}
		return -1;
	}*/
	static void update(int l,int r,int rt,int k) 
	{
		if(l==r && l==k) 
		{
			tree[rt]=p[k].size()==0?-1:p[k].last();//存下最大值
			return ;
		}
		int mid=(l+r)>>1;
		if(k<=mid)update(l,mid, rt<<1, k);
		else update(mid+1, r, rt<<1|1, k);
		tree[rt]=Math.max(tree[rt<<1],tree[rt<<1|1]);
	}
	static int query(int a,int b,int l,int r,int rt,int val) 
	{
		if(a>b)return -1;
		if(tree[rt]<=val)return -1;
		if(l==r) return l; 
		int mid=(l+r)>>1;
		int ans=-1;
		if(a<=mid)ans=query(a,b,l,mid, rt<<1, val);
		if(ans==-1)ans=query(a, b, mid+1, r, rt<<1|1, val);
		return ans;
	}
	static void bfs(int l,int r)
	{
		Queue<Integer> q1=new LinkedList<Integer>();
		Queue<Integer> q2=new LinkedList<Integer>();
		q1.add(1);
		q2.add(tree[1]);
		int t=0,cnt=1;
		while(q1.size()>0) 
		{
			int rt=q1.poll();
			int val=q2.poll();
			if(val==-1) {out.print("    ");continue;}
			t++;
			if(t==1<<cnt) {t=0;cnt+=1;out.printLine();}
			out.print(rt+" "+val);
			q1.add(rt<<1);q2.add(tree[rt<<1]);
			q1.add(rt<<1|1);q2.add(tree[rt<<1]|1);
			
		}
	}
}


//封装基于字节流读取的高效输入类InputReader，避免Scanner的低效率，比streamTokenizer快读还快；
class InputReader
{
	// java.io.InputStream 所有字节输入流的父类
	private InputStream stream;
	// 输入缓存byte数组
	private byte[] buf = new byte[1024];
	private int curChar;// 当前字符
	private int numChars;// 总输入字符
	// 自定义接口
	private SpaceCharFilter filter;

	// 构造函数
	public InputReader(InputStream stream)
	{
		this.stream = stream;
	}

	//尝试至少读取一个字节并存储到缓冲数组buf中
	public int read()
	{
		if (numChars == -1)throw new InputMismatchException();
		//既然是缓冲读取，如果1次读取1024个，那么每次直接缓冲区读取 如果curChar<numChar 那么证明缓冲区的还没有用完
		if (curChar >= numChars)
		{
			curChar = 0;//缓冲区的数据用完了，那么从0开始，再去一次性读取若干个放到缓冲数组里
			try
			{
				// 从输入流中读取一定数量的字节，并将其存储在缓冲区数组buf中，numChar等于实际读取的字节数量
				numChars = stream.read(buf);
			} 
			catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)//如果读取的有效数量为0，那么返回-1，巧妙的避开了合法的ASCII码
				return -1;
		}
		//等价于else (curChar<numChar),如果缓冲区没有用完，直接返回缓冲区当前第curChar字符，指针后移
		return buf[curChar++];
	}

	//读入一个一个字节，手工构造int
	public int readInt()
	{
		int c = read();
		while (isSpaceChar(c))//忽略>=1的所有空格符或者自己定义的不能构成整数的无意义符号入\n\r\t等
			c = read();
		int sgn = 1;//识别第一符号位，判定是正数还是负数
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		//不断的*10+当前数构成int的判断
		return res * sgn;
	}

	//读入一个一个字节，手工构造long
	public long readLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	//高效的读取字符串
	public String readString()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			//确定指定的代码点是否是一个有效的Unicode代码点值
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);//追加Unicode代码点值
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}
	//统一Scanner的语法习惯
	public String next()
	{
		return readString();
	}
	//读入一行字符串数组
	public static String[] readStringArray(InputReader in, int size) 
	{
		String[] array = new String[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readString();
		return array;
	}
	//读入二维字符数组
	public static String[][] readStringTable(InputReader in, int rowCount, int columnCount) 
	{
		String[][] table = new String[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readStringArray(in, columnCount);
		return table;
	}
	//读入char
	public char readCharacter()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}
	//读入一行字符串
	public String readStringLine()
	{
		int c = read();
		while (isSpaceChar2(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			//确定指定的代码点是否是一个有效的Unicode代码点值
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);//追加Unicode代码点值
			c = read();
		} while (!isSpaceChar2(c));
		return res.toString();
	}
	
	//读入double
	public double readDouble()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.')
		{
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.')
		{
			c = read();
			double m = 1;
			while (!isSpaceChar(c))
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}
	public boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}
	
	public boolean isSpaceChar2(int c)
	{
		if (filter != null)
			return filter.isSpaceChar2(c);
		return isWhitespace2(c);
	}
	//可以输入空格的一行
	public static boolean isWhitespace2(int c)
	{
		return c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	// 自定义接口，定了一个抽象方法判断是否是空格符
	public interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
		
		public boolean isSpaceChar2(int ch);
	}
}


class OutputWriter
{
	//向文本输出流打印对象的格式化表现形式 extends java.io.Writer
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream)
	{
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				outputStream)));
	}
//打印数组用空格分隔
	public void print(int[] array)
	{
		for (int i = 0; i < array.length; i++)
		{
			if (i != 0)
				writer.print(' ');
			writer.print(array[i]);
		}
	}
//带换行的数组打印
	public void printLine(int[] array)
	{
		print(array);
		writer.println();
	}

	public void print(Object... objects)
	{
		for (int i = 0; i < objects.length; i++)
		{
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object... objects)
	{
		print(objects);
		writer.println();
	}

	public void close()
	{
		writer.close();
	}
	public void print(int i)
	{
		writer.print(i);
	}
	public void print(String i)
	{
		writer.print(i);
	}
	public void print(long i)
	{
		writer.print(i);
	}
	public void print(char i)
	{
		writer.print(i);
	}
	public void printf(String format,Object... x)
	{
		writer.printf(format,x);
	}
//打印带换行的整数i
	public void printLine(int i)
	{
		writer.println(i);
	}	
	public void printLine(long i) 
	{
		writer.println(i);
	}
}

class IOUtils
{
//高效读入整型一维数组
	public static int[] readIntArray(InputReader in, int size)
	{
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readInt();
		return array;
	}
	//调用上面的读入一维数组的快速读取二维数组
	public static int[][] readIntTable(InputReader in, int rowCount, int columnCount) {
		int[][] table = new int[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readIntArray(in, columnCount);
		return table;
	}
	//相当于二维数组（多关键字参数的另外一种写法）
	public static void readIntArrays(InputReader in, int[]... arrays)
	{
		for (int i = 0; i < arrays[0].length; i++)
		{
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readInt();
		}
	}
	
	public static char[] readCharArray(InputReader in, int size)
	{
		char[] array = new char[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readCharacter();
		return array;
	}

	public static char[][] readTable(InputReader in, int rowCount,int columnCount)
	{
		char[][] table = new char[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readCharArray(in, columnCount);
		return table;
	}

}
class MiscUtils
{
	public static void decreaseByOne(int[]... arrays)
	{
		for (int[] array : arrays)
		{
			for (int i = 0; i < array.length; i++)
				array[i]--;
		}
	}

}