#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct Segtree {
  int l, r, mx;
} tr[maxn * 4];
set<int> st[maxn];
void build(int id, int l, int r) {
  tr[id].l = l;
  tr[id].r = r;
  tr[id].mx = -1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(id << 1, l, mid);
  build(id << 1 | 1, mid + 1, r);
}
inline void push_up(int id) {
  tr[id].mx = max(tr[id << 1].mx, tr[id << 1 | 1].mx);
}
inline void Add(int id, int x, int v) {
  if (tr[id].l == tr[id].r) {
    st[x].insert(v);
    tr[id].mx = max(tr[id].mx, v);
    return;
  }
  int mid = (tr[id].l + tr[id].r) >> 1;
  if (x <= mid)
    Add(id << 1, x, v);
  else
    Add(id << 1 | 1, x, v);
  push_up(id);
}
inline void Remove(int id, int x, int v) {
  if (tr[id].l == tr[id].r) {
    st[x].erase(v);
    if (st[x].empty())
      tr[id].mx = -1;
    else
      tr[id].mx = *st[x].rbegin();
    return;
  }
  int mid = (tr[id].l + tr[id].r) >> 1;
  if (x <= mid)
    Remove(id << 1, x, v);
  else
    Remove(id << 1 | 1, x, v);
  push_up(id);
}
inline int Ask(int id, int x, int v) {
  if (tr[id].mx <= v) return -1;
  if (tr[id].l == tr[id].r) {
    if (tr[id].l > x && tr[id].mx > v) return tr[id].l;
    return -1;
  }
  int mid = (tr[id].l + tr[id].r) >> 1;
  int p = -1;
  if (mid > x) p = Ask(id << 1, x, v);
  if (p != -1) return p;
  return Ask(id << 1 | 1, x, v);
}
int data[maxn], cc;
struct Ope {
  int t, x, y;
} op[maxn];
inline int Find(int x) { return lower_bound(data, data + cc, x) - data; }
int main() {
  char s[10];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    if (*s == 'a')
      op[i].t = 0;
    else if (*s == 'r')
      op[i].t = 1;
    else
      op[i].t = 2;
    scanf("%d%d", &op[i].x, &op[i].y);
    data[cc++] = op[i].x;
  }
  sort(data, data + cc);
  cc = unique(data, data + cc) - data;
  build(1, 0, cc - 1);
  for (int i = 0; i < n; ++i) {
    if (op[i].t == 0)
      Add(1, Find(op[i].x), op[i].y);
    else if (op[i].t == 1)
      Remove(1, Find(op[i].x), op[i].y);
    else {
      int x = Ask(1, Find(op[i].x), op[i].y);
      if (x == -1) {
        puts("-1");
        continue;
      }
      set<int>::iterator it = st[x].upper_bound(op[i].y);
      printf("%d %d\n", data[x], *it);
    }
  }
  return 0;
}
