#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
struct Seg_Tree {
  int N;
  int maxx[maxn << 2];
  set<int> val[maxn];
  void init() {
    memset(val, 0, sizeof val);
    for (int i = 0; i < N; i++) val[i].clear();
  }
  inline void up(int rt) { maxx[rt] = max(maxx[rt << 1], maxx[rt << 1 | 1]); }
  void build(int rt, int l, int r) {
    if (l == r) return;
    int mid = l + r >> 1;
    build(rt << 1, l, mid);
    build(rt << 1 | 1, mid + 1, r);
  }
  void update(int rt, int l, int r, int L, int del) {
    maxx[rt] = max(maxx[rt], del);
    if (l == r) {
      val[L].insert(del);
      return;
    }
    int mid = l + r >> 1;
    if (L <= mid)
      update(rt << 1, l, mid, L, del);
    else
      update(rt << 1 | 1, mid + 1, r, L, del);
  }
  void remove(int rt, int l, int r, int L, int del) {
    if (l == r) {
      val[L].erase(del);
      maxx[rt] = val[L].empty() ? -1 : *(--val[L].end());
      return;
    }
    int mid = l + r >> 1;
    if (L <= mid)
      remove(rt << 1, l, mid, L, del);
    else
      remove(rt << 1 | 1, mid + 1, r, L, del);
    up(rt);
  }
  pair<int, int> query(int rt, int l, int r, int L, int del) {
    if (maxx[rt] < del || r < L) return {-1, -1};
    if (l == r) return {l, *(val[l].lower_bound(del))};
    int mid = l + r >> 1;
    pair<int, int> tmp = query(rt << 1, l, mid, L, del);
    if (tmp.first != -1)
      return tmp;
    else
      return query(rt << 1 | 1, mid + 1, r, L, del);
  }
} seg;
unordered_map<int, int> id;
struct node {
  char s[10];
  int x, y;
} A[maxn];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    seg.N = n;
    vector<int> tmp;
    for (int i = 0; i < n; i++) {
      scanf("%s%d%d", A[i].s, &A[i].x, &A[i].y);
      tmp.push_back(A[i].x);
    }
    sort(begin(tmp), end(tmp));
    tmp.erase(unique(begin(tmp), end(tmp)), tmp.end());
    int len = tmp.size();
    for (int i = 0; i < len; i++) {
      id[tmp[i]] = i;
    }
    for (int i = 0; i < n; i++) {
      int x = A[i].x, y = A[i].y;
      if (A[i].s[0] == 'a')
        seg.update(1, 0, len, id[x], y);
      else if (A[i].s[0] == 'r')
        seg.remove(1, 0, len, id[x], y);
      else {
        pair<int, int> res = seg.query(1, 0, len, id[x] + 1, y + 1);
        if (res.first == -1)
          puts("-1");
        else
          printf("%d %d\n", tmp[res.first], res.second);
      }
    }
  }
  return 0;
}
