#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
struct Tree {
  int x, y;
  char op[5];
  void init() { scanf("%s%d%d", op, &x, &y); }
} tree[maxn << 2];
set<int> xx[maxn];
int maxy[maxn << 2], top[maxn], n, m;
void buildtree(int l, int r, int dex) {
  maxy[dex] = -1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  buildtree(l, mid, dex << 1);
  buildtree(mid + 1, r, dex << 1 | 1);
}
void update(int l, int r, int dex, int pos) {
  if (l == r) {
    if (xx[pos].size())
      maxy[dex] = *(--xx[pos].end());
    else
      maxy[dex] = -1;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(l, mid, dex << 1, pos);
  else
    update(mid + 1, r, dex << 1 | 1, pos);
  maxy[dex] = max(maxy[dex << 1], maxy[dex << 1 | 1]);
}
int Query(int l, int r, int dex, int L, int R, int val) {
  if (maxy[dex] <= val || L > R) return -1;
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return Query(l, mid, dex << 1, L, R, val);
  else if (L > mid)
    return Query(mid + 1, r, dex << 1 | 1, L, R, val);
  else {
    int t = Query(l, mid, dex << 1, L, mid, val);
    if (t != -1) return t;
    return Query(mid + 1, r, dex << 1 | 1, mid + 1, R, val);
  }
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      tree[i].init();
      top[i] = tree[i].x;
    }
    sort(top + 1, top + 1 + n);
    m = unique(top + 1, top + 1 + n) - (top + 1);
    for (int i = 1; i <= m; i++) xx[i].clear();
    buildtree(1, m, 1);
    for (int i = 1; i <= n; i++) {
      int pos = lower_bound(top + 1, top + 1 + m, tree[i].x) - top;
      if (tree[i].op[0] == 'a') {
        xx[pos].insert(tree[i].y);
        update(1, m, 1, pos);
      } else if (tree[i].op[0] == 'r') {
        xx[pos].erase(tree[i].y);
        update(1, m, 1, pos);
      } else {
        int ans = Query(1, m, 1, pos + 1, m, tree[i].y);
        if (ans == -1)
          printf("-1\n");
        else
          printf("%d %d\n", top[ans], *xx[ans].upper_bound(tree[i].y));
      }
    }
  }
  return 0;
}
