#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > queries;
vector<int> vx;
map<int, int> mx, my;
set<int> s[200002];
int inf = 2e9;
int tree[4 * 200002];
void update(int nd, int lo, int hi, int idx, int val) {
  int md = (lo + hi) >> 1;
  if (lo == hi) {
    tree[nd] = val;
    return;
  }
  if (idx > md)
    update(nd * 2 + 1, md + 1, hi, idx, val);
  else
    update(nd * 2, lo, md, idx, val);
  tree[nd] = max(tree[nd * 2], tree[nd * 2 + 1]);
}
int query(int nd, int lo, int hi, int l, int r, int y) {
  if (tree[nd] <= y or lo > r or hi < l) return inf;
  if (lo == hi) return lo;
  int md = (lo + hi) >> 1;
  int x = query(nd * 2, lo, md, l, r, y);
  if (x != inf) return x;
  return query(nd * 2 + 1, md + 1, hi, l, r, y);
}
signed main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (long long i = 0; i <= n - 1; i++) {
    string s;
    cin >> s;
    int p, q;
    cin >> p >> q;
    int c = 0;
    if (s[0] == 'r')
      c = 1;
    else if (s[0] == 'f')
      c = 2;
    vector<int> vv{c, p, q};
    queries.push_back(vv);
    vx.push_back(p);
  }
  sort((vx).begin(), (vx).end());
  vx.erase(unique((vx).begin(), (vx).end()), vx.end());
  for (long long i = 0; i <= ((int)((vx).size())) - 1; i++) mx[vx[i]] = i;
  memset(tree, -1, sizeof(tree));
  for (long long i = 0; i <= n - 1; i++) {
    int x = queries[i][1];
    int y = queries[i][2];
    if (queries[i][0] == 0) {
      if (s[mx[x]].empty() or y > (*prev(s[mx[x]].end())))
        update(1, 0, n, mx[x], y);
      s[mx[x]].insert(y);
    } else if (queries[i][0] == 1) {
      if ((*prev(s[mx[x]].end())) == y) {
        s[mx[x]].erase(y);
        int zz = -1;
        if (!s[mx[x]].empty()) zz = (*prev(s[mx[x]].end()));
        update(1, 0, n, mx[x], zz);
      }
      s[mx[x]].erase(y);
    } else {
      int zz = query(1, 0, n, mx[x] + 1, n, y);
      if (zz == inf)
        cout << -1 << "\n";
      else {
        int xx = vx[zz];
        int yy = *s[zz].lower_bound(y + 1);
        cout << xx << " " << yy << "\n";
      }
    }
  }
}
