#include <bits/stdc++.h>
using namespace std;
int x[500000], y[500000], op[500000];
char b[20];
set<int> xs[500000];
int n;
int v[500000 * 6];
int seg[500000 * 6], NN2, N;
void update(int x, int val) {
  v[x] = val;
  x += NN2;
  seg[x] = val;
  while (x / 2 > 0) {
    x /= 2;
    seg[x] = max(seg[2 * x], seg[2 * x + 1]);
  }
}
void init(int n) {
  NN2 = (1 << (32 - __builtin_clz(n - 1))) - 1;
  N = NN2 * 2 + 2;
  for (int i = n + 1; i <= NN2 + 1; i++) v[i] = 0;
  for (int i = NN2 + 1; i < N; i++) seg[i] = v[i - NN2];
  for (int i = NN2; i >= 0; i--) seg[i] = seg[2 * i] + seg[2 * i + 1];
}
int query(int i, int j) {
  int res = 0;
  i += NN2;
  j += NN2;
  while (i <= j) {
    if (i & 1) res = max(res, seg[i]);
    if (!(j & 1)) res = max(res, seg[j]);
    i = (i + 1) / 2;
    j = (j - 1) / 2;
  }
  return res;
}
int main() {
  vector<int> val;
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    scanf("%s%d%d", b, x + i, y + i);
    if (b[0] == 'a') op[i] = 0;
    if (b[0] == 'r') op[i] = 1;
    if (b[0] == 'f') op[i] = 2;
    val.push_back(x[i]);
    val.push_back(y[i]);
  }
  sort(val.begin(), val.end());
  typeof(val.begin()) end = unique(val.begin(), val.end());
  n = end - val.begin();
  init(n);
  for (int i = 0; i < q; ++i) {
    x[i] = lower_bound(val.begin(), end, x[i]) - val.begin();
    y[i] = lower_bound(val.begin(), end, y[i]) - val.begin();
  }
  for (int i = 0; i < q; ++i) {
    if (op[i] == 0) {
      if (xs[x[i]].empty() || *xs[x[i]].rbegin() < y[i]) {
        update(x[i], y[i]);
      }
      xs[x[i]].insert(y[i]);
    } else if (op[i] == 2) {
      int lo = x[i] + 1, hi = n - 1, m;
      if (lo > hi || query(lo, hi) <= y[i]) {
        printf("-1\n");
      } else {
        while (lo != hi) {
          m = (lo + hi) >> 1;
          if (query(x[i] + 1, m) <= y[i])
            lo = m + 1;
          else
            hi = m;
        }
        int ya = *xs[lo].lower_bound(y[i] + 1);
        printf("%d %d\n", val[lo], val[ya]);
      }
    } else if (op[i] == 1) {
      int tmp = *xs[x[i]].rbegin();
      xs[x[i]].erase(y[i]);
      if (tmp == y[i]) {
        int upd = 0;
        if (!xs[x[i]].empty()) upd = *xs[x[i]].rbegin();
        update(x[i], upd);
      }
    }
  }
  return 0;
}
