#include <bits/stdc++.h>
using namespace std;
const int maxn = 200011;
int mx[maxn << 2];
int X[maxn];
set<int> S[maxn];
void pushUp(int rt) { mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]); }
void build(int l, int r, int rt) {
  mx[rt] = -1;
  if (l == r) return;
  int m = (l + r) >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
}
void update(int k, int val, int l, int r, int rt) {
  if (k == l && k == r) {
    mx[rt] = val;
    return;
  }
  int m = (l + r) >> 1;
  if (k <= m)
    update(k, val, l, m, rt << 1);
  else
    update(k, val, m + 1, r, rt << 1 | 1);
  pushUp(rt);
}
int query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    return mx[rt];
  }
  int m = (l + r) >> 1;
  int ret = -1;
  if (L <= m) ret = max(ret, query(L, R, l, m, rt << 1));
  if (m < R) ret = max(ret, query(L, R, m + 1, r, rt << 1 | 1));
  return ret;
}
struct OP {
  char op[10];
  int x, y;
} Q[maxn];
int main() {
  int cas = 0;
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < (n); i++) {
      scanf("%s%d%d", Q[i].op, &Q[i].x, &Q[i].y);
      X[i] = Q[i].x;
    }
    sort(X, X + n);
    int m = unique(X, X + n) - X;
    build(0, m - 1, 1);
    for (int i = 0; i < (maxn); i++) S[i].clear();
    set<int>::iterator it;
    for (int i = 0; i < (n); i++) {
      int x = Q[i].x, y = Q[i].y;
      int idx = lower_bound(X, X + m, x) - X;
      if (Q[i].op[0] == 'a') {
        S[idx].insert(y);
        it = S[idx].end();
        it--;
        update(idx, *it, 0, m - 1, 1);
      } else if (Q[i].op[0] == 'r') {
        it = S[idx].find(y);
        S[idx].erase(it);
        if (S[idx].size()) {
          it = S[idx].end();
          it--;
          update(idx, *it, 0, m - 1, 1);
        } else {
          update(idx, -1, 0, m - 1, 1);
        }
      } else {
        int pos = -1;
        int l = idx + 1, r = m - 1;
        while (l <= r) {
          int mid = (l + r) >> 1;
          if (query(idx + 1, mid, 0, m - 1, 1) > y) {
            pos = mid;
            r = mid - 1;
          } else {
            l = mid + 1;
          }
        }
        if (pos == -1)
          puts("-1");
        else {
          int xx = X[pos];
          int yy;
          it = S[pos].upper_bound(y);
          yy = *it;
          printf("%d %d\n", xx, yy);
        }
      }
    }
  }
  return 0;
}
