#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
namespace st {
int n;
vector<int> a;
void build(int count) {
  n = 1;
  while (n < count) n *= 2;
  a.assign(2 * n - 1, -inf);
}
void set(int i, int x) {
  i += n - 1;
  a[i] = x;
  while (i > 0) {
    i = (i - 1) / 2;
    a[i] = max(a[i * 2 + 1], a[i * 2 + 2]);
  }
}
int find(int i, int tl, int tr, int l, int r, int y) {
  if (l >= r || a[i] <= y) return inf;
  if (tl == tr - 1) return i - (n - 1);
  int m = (tr + tl) >> 1;
  if (tl == l && tr == r) {
    int a1 = a[i * 2 + 1];
    int a2 = a[i * 2 + 2];
    if (a1 > y) return find(i * 2 + 1, tl, m, l, m, y);
    return find(i * 2 + 2, m, tr, m, r, y);
  }
  return min(find(i * 2 + 1, tl, m, l, min(r, m), y),
             find(i * 2 + 2, m, tr, max(l, m), r, y));
}
int find(int x, int y) { return find(0, 0, n, x + 1, n, y); }
};  // namespace st
const int ADD = 0, REMOVE = 1, FIND = 2;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> type(n), ax(n), ay(n);
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    int x, y;
    scanf("%d%d", &x, &y);
    ax[i] = x;
    ay[i] = y;
    if (s == "add") {
      type[i] = ADD;
    } else if (s == "remove") {
      type[i] = REMOVE;
    } else {
      type[i] = FIND;
    }
  }
  vector<int> sx(ax);
  sort(sx.begin(), sx.end());
  map<int, int> biec;
  vector<int> back(n);
  for (auto i : sx) {
    biec[i] = biec.size() - 1;
    back[(int)biec.size() - 1] = i;
  }
  int cx = biec.size();
  st::build(cx);
  vector<set<int> > my(cx);
  for (int i = 0; i < n; ++i) {
    int x, y;
    x = biec[ax[i]];
    y = ay[i];
    int tp = type[i];
    if (tp == ADD) {
      my[x].insert(y);
      st::set(x, *my[x].rbegin());
    } else if (tp == REMOVE) {
      my[x].erase(y);
      st::set(x, my[x].empty() ? -inf : *my[x].rbegin());
    } else {
      x = st::find(x, y);
      if (x == inf) {
        printf("%d\n", -1);
        continue;
      }
      auto ny = my[x].upper_bound(y);
      if (ny == my[x].end()) {
        printf("%d\n", -1);
      } else {
        printf("%d ", back[x]);
        printf("%d\n", *ny);
      }
    }
  }
  return 0;
}
