#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
struct tree {
  int l, r, mid, maxx;
} t[maxn * 4];
struct quest {
  int op, x, y;
} q[maxn];
int b[maxn], bc, n;
multiset<int> s[maxn];
char op[10];
void build(int id, int l, int r) {
  t[id] = (tree){l, r, (l + r) / 2, int(-1e9)};
  if (l == r) return;
  int mid = (l + r) / 2;
  build(id << 1, l, mid);
  build(id << 1 | 1, mid + 1, r);
}
void pushup(int id) { t[id].maxx = max(t[id << 1].maxx, t[id << 1 | 1].maxx); }
void add(int id, int v) {
  if (t[id].l == t[id].r) {
    t[id].maxx = s[t[id].l].empty() ? -1e9 : (*(--s[t[id].l].end()));
    return;
  }
  v <= t[id].mid ? add(id << 1, v) : add(id << 1 | 1, v);
  pushup(id);
}
int ask(int id, int l, int v) {
  if (t[id].l >= l + 1) {
    if (t[id].maxx <= v) return -1e9;
    if (t[id].l == t[id].r) return t[id].l;
  }
  int ans = -1e9;
  if (l + 1 <= t[id].mid && t[id << 1].maxx > v) ans = ask(id << 1, l, v);
  if (ans == -1e9 && t[id << 1 | 1].maxx > v) ans = ask(id << 1 | 1, l, v);
  return ans;
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    scanf("%s%d%d", op, &q[i].x, &q[i].y);
    switch (op[0]) {
      case 'a': {
        q[i].op = 0;
        break;
      }
      case 'r': {
        q[i].op = 1;
        break;
      }
      case 'f': {
        q[i].op = 2;
        break;
      }
    }
    b[++bc] = q[i].x, b[++bc] = q[i].y;
  }
  sort(b + 1, b + bc + 1);
  bc = unique(b + 1, b + bc + 1) - b - 1;
  build(1, 1, bc);
  for (register int i = 1; i <= n; i++) {
    q[i].x = lower_bound(b + 1, b + bc + 1, q[i].x) - b;
    q[i].y = lower_bound(b + 1, b + bc + 1, q[i].y) - b;
    switch (q[i].op) {
      case 0: {
        s[q[i].x].insert(q[i].y);
        add(1, q[i].x);
        break;
      }
      case 1: {
        multiset<int>::iterator it = s[q[i].x].find(q[i].y);
        s[q[i].x].erase(it);
        add(1, q[i].x);
        break;
      }
      case 2: {
        int p = ask(1, q[i].x, q[i].y);
        if (p == -1e9) {
          puts("-1");
          break;
        }
        multiset<int>::iterator it = s[p].upper_bound(q[i].y);
        printf("%d %d\n", b[p], b[*it]);
        break;
      }
    }
  }
  return 0;
}
