#include <bits/stdc++.h>
using namespace std;
struct Instruction {
  char s[10];
  int x, y, z;
} ins[200010];
struct Point {
  int x, y;
} p[200010];
map<pair<int, int>, int> mp;
map<int, int> nt;
int n, m;
int mx[1000010];
void update(int k, int val, int idx, int l, int r) {
  if (l == r) {
    mx[idx] = val;
    return;
  }
  int mid = l + ((r - l) >> 1);
  if (k <= mid)
    update(k, val, idx * 2, l, mid);
  else
    update(k, val, idx * 2 + 1, mid + 1, r);
  mx[idx] = max(mx[idx * 2], mx[idx * 2 + 1]);
}
int find(int k, int val, int idx, int l, int r) {
  if (mx[idx] <= val) return -1;
  if (l == r)
    if (k >= l)
      return -1;
    else
      return l;
  int mid = l + ((r - l) >> 1);
  if (k < l)
    if (mx[idx * 2] > val)
      return find(k, val, idx * 2, l, mid);
    else
      return find(k, val, idx * 2 + 1, mid + 1, r);
  else if (k <= mid) {
    int ret = find(k, val, idx * 2, l, mid);
    if (ret == -1)
      return find(k, val, idx * 2 + 1, mid + 1, r);
    else
      return ret;
  } else
    return find(k, val, idx * 2 + 1, mid + 1, r);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s%d%d", ins[i].s, &ins[i].x, &ins[i].y);
    mp[make_pair(ins[i].x, ins[i].y)] = 0;
  }
  m = 0;
  for (map<pair<int, int>, int>::iterator mapi = mp.begin(); mapi != mp.end();
       mapi++) {
    m++;
    mapi->second = m;
    p[m].x = (mapi->first).first;
    p[m].y = (mapi->first).second;
    nt[p[m].x] = m;
  }
  memset(mx, -1, sizeof(mx));
  for (int i = 1; i <= n; i++) {
    if (ins[i].s[0] == 'a')
      update(mp[make_pair(ins[i].x, ins[i].y)], ins[i].y, 1, 1, m);
    else if (ins[i].s[0] == 'r')
      update(mp[make_pair(ins[i].x, ins[i].y)], -1, 1, 1, m);
    else {
      int k = find(nt[ins[i].x], ins[i].y, 1, 1, m);
      if (k == -1)
        puts("-1");
      else
        printf("%d %d\n", p[k].x, p[k].y);
    }
  }
  return 0;
}
