#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, M = 13331;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
inline int read() {
  int first = 0, neg = 1;
  char op = getchar();
  while (!isdigit(op)) {
    if (op == '-') neg = -1;
    op = getchar();
  }
  while (isdigit(op)) {
    first = 10 * first + op - '0';
    op = getchar();
  }
  return neg * first;
}
inline void print(int first) {
  if (first < 0) {
    putchar('-');
    first = -first;
  }
  if (first >= 10) print(first / 10);
  putchar(first % 10 + '0');
}
struct Node {
  int l, r;
  int mx;
} tr[N << 2];
set<int> s[N << 2];
struct Query {
  char op[10];
  int first, second;
} q[N];
int b[N], len;
int find(int first) { return lower_bound(b + 1, b + 1 + len, first) - b; }
void push_up(int u) { tr[u].mx = max(tr[u << 1].mx, tr[u << 1 | 1].mx); }
void build(int u, int l, int r) {
  tr[u] = {l, r, 0};
  if (l == r) return;
  int mid = l + r >> 1;
  build(u << 1, l, mid);
  build(u << 1 | 1, mid + 1, r);
}
void update(int u, int first, int val) {
  if (tr[u].l == tr[u].r) {
    tr[u].mx = val;
    return;
  }
  int mid = tr[u].l + tr[u].r >> 1;
  if (first <= mid)
    update(u << 1, first, val);
  else
    update(u << 1 | 1, first, val);
  push_up(u);
}
int query(int u, int first, int second) {
  if (tr[u].l == tr[u].r) {
    if (tr[u].mx <= second) return -1;
    if (tr[u].l <= first) return -1;
    return tr[u].l;
  }
  int mid = tr[u].l + tr[u].r >> 1;
  int res = -1;
  if (first + 1 <= mid && tr[u << 1].mx > second)
    res = query(u << 1, first, second);
  if (res != -1) return res;
  return query(u << 1 | 1, first, second);
}
void solve() {
  int n;
  n = read();
  for (int i = 1; i <= n; i++) {
    scanf("%s", q[i].op);
    q[i].first = read(), q[i].second = read();
    b[i] = q[i].first;
  }
  sort(b + 1, b + 1 + n);
  len = unique(b + 1, b + 1 + n) - b - 1;
  build(1, 1, len);
  for (int i = 1; i <= n; i++) {
    q[i].first = find(q[i].first);
    if (q[i].op[0] == 'a') {
      int first = q[i].first;
      s[first].insert(q[i].second);
      auto it = s[first].end();
      it--;
      update(1, first, *it);
    } else if (q[i].op[0] == 'r') {
      int first = q[i].first;
      s[first].erase(s[first].find(q[i].second));
      if (s[first].size() == 0)
        update(1, first, 0);
      else {
        auto it = s[first].end();
        it--;
        update(1, first, *it);
      }
    } else {
      int res = query(1, q[i].first, q[i].second);
      if (res == -1) {
        printf("%d\n", res);
        continue;
      }
      printf("%d %d\n", b[res], *(s[res].upper_bound(q[i].second)));
    }
  }
}
int main() {
  solve();
  return 0;
}
