#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const long long int INF = 1e18;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
set<int> st[maxn];
struct Tree {
  int tl, tr;
  int mx;
} tree[maxn << 2];
void pushup(int i) { tree[i].mx = max(tree[i << 1].mx, tree[i << 1 | 1].mx); }
void build(int id, int l, int r) {
  tree[id].tl = l;
  tree[id].tr = r;
  tree[id].mx = -1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(id << 1, l, mid);
  build(id << 1 | 1, mid + 1, r);
}
void update(int id, int pos, int val, int y) {
  int l = tree[id].tl, r = tree[id].tr;
  if (l == r && l == pos) {
    if (val == 1)
      st[pos].insert(y);
    else
      st[pos].erase(y);
    if ((int)(st[pos]).size())
      tree[id].mx = *(--st[pos].end());
    else
      tree[id].mx = -1;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(id << 1, pos, val, y);
  else
    update(id << 1 | 1, pos, val, y);
  pushup(id);
}
int query(int id, int ql, int qr, int y) {
  int l = tree[id].tl, r = tree[id].tr;
  if (tree[id].mx <= y || ql > qr) return -1;
  int mid = (l + r) >> 1;
  if (l == r) return l;
  if (qr <= mid)
    return query(id << 1, ql, qr, y);
  else if (ql > mid)
    return query(id << 1 | 1, ql, qr, y);
  else {
    int tmp = query(id << 1, ql, mid, y);
    if (tmp != -1) return tmp;
    return query(id << 1 | 1, mid + 1, qr, y);
  }
}
vector<int> ve;
int getid(int x) {
  return lower_bound(ve.begin(), ve.end(), x) - ve.begin() + 1;
}
struct Point {
  char op[10];
  int x, y;
} q[maxn];
void solve() {
  int n;
  scanf("%d", &n);
  ve.push_back(0);
  for (int i = 1; i <= n; i++) {
    scanf("%s%d%d", q[i].op, &q[i].x, &q[i].y);
    if (q[i].op[0] != 'r') ve.push_back(q[i].x);
  }
  sort(ve.begin(), ve.end());
  ve.erase(unique(ve.begin(), ve.end()), ve.end());
  build(1, 1, (int)(ve).size());
  for (int i = 1; i <= n; i++) {
    if (q[i].op[0] == 'a') {
      update(1, getid(q[i].x), 1, q[i].y);
    } else if (q[i].op[0] == 'r') {
      update(1, getid(q[i].x), 0, q[i].y);
    } else {
      int idx = query(1, getid(q[i].x) + 1, (int)(ve).size(), q[i].y);
      if (idx == -1)
        printf("-1\n");
      else {
        int tmp = ve[idx - 1];
        printf("%d %d\n", tmp, *st[idx].upper_bound(q[i].y));
      }
    }
  }
}
int main() {
  int t = 1, cas = 1;
  while (t--) {
    solve();
  }
}
