#include <bits/stdc++.h>
using namespace std;
vector<int> sx;
map<int, int> imap;
struct Node {
  char t[10];
  int x, y;
  void input() {
    scanf("%s %d %d", t, &x, &y);
    sx.push_back(x);
  }
} p[200005];
int tree[200005 << 2];
set<int> st[200005];
void Add(int pos, int num, int l, int r, int rt) {
  tree[rt] = max(tree[rt], num);
  if (l == r) {
    st[l].insert(num);
    return;
  }
  int m = (l + r) >> 1;
  if (pos <= m)
    Add(pos, num, l, m, rt << 1);
  else
    Add(pos, num, m + 1, r, rt << 1 | 1);
}
void Sub(int pos, int num, int l, int r, int rt) {
  if (l == r) {
    st[l].erase(num);
    tree[rt] = st[l].empty() ? -1 : *(--st[l].end());
    return;
  }
  int m = (l + r) >> 1;
  if (pos <= m)
    Sub(pos, num, l, m, rt << 1);
  else
    Sub(pos, num, m + 1, r, rt << 1 | 1);
  tree[rt] = max(tree[rt << 1], tree[rt << 1 | 1]);
}
pair<int, int> Query(int pos, int num, int l, int r, int rt) {
  if (r < pos || tree[rt] < num) return make_pair(-1, -1);
  if (l == r) return make_pair(l, *(st[l].lower_bound(num)));
  int m = (l + r) >> 1;
  pair<int, int> tmp = Query(pos, num, l, m, rt << 1);
  if (tmp.first != -1) return tmp;
  return Query(pos, num, m + 1, r, rt << 1 | 1);
}
int main() {
  int n;
  int i, j, k;
  while (~scanf("%d", &n)) {
    memset(tree, -1, sizeof(tree));
    for (i = 0; i < n; i++) st[i].clear();
    sx.clear();
    imap.clear();
    for (i = 0; i < n; i++) p[i].input();
    sort(sx.begin(), sx.end());
    sx.erase(unique(sx.begin(), sx.end()), sx.end());
    int len = sx.size() - 1;
    for (i = 0; i <= len; i++) imap[sx[i]] = i;
    for (i = 0; i < n; i++) {
      int xx = p[i].x;
      int yy = p[i].y;
      if (p[i].t[0] == 'a') {
        Add(imap[xx], yy, 0, len, 1);
      } else if (p[i].t[0] == 'r') {
        Sub(imap[xx], yy, 0, len, 1);
      } else {
        pair<int, int> ans = Query(imap[xx] + 1, yy + 1, 0, len, 1);
        if (ans.first == -1)
          printf("-1\n");
        else
          printf("%d %d\n", sx[ans.first], ans.second);
      }
    }
  }
  return 0;
}
