#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int INF = 1e9;
struct tree {
  set<int> f;
  int l, r, mx;
} tr[maxn << 2];
void push_up(int now) {
  tr[now].mx = max(tr[now << 1].mx, tr[now << 1 | 1].mx);
  return;
}
void build(int now, int l, int r) {
  tr[now].l = l;
  tr[now].r = r;
  tr[now].mx = -1;
  tr[now].f.clear();
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(now << 1, l, mid);
  build(now << 1 | 1, mid + 1, r);
  push_up(now);
  return;
}
set<int>::iterator p;
void update(int now, int pos, int val, int type) {
  if (tr[now].l == tr[now].r) {
    if (type == 0)
      tr[now].f.insert(val);
    else
      tr[now].f.erase(val);
    if (tr[now].f.empty())
      tr[now].mx = -1;
    else
      tr[now].mx = *(--(p = tr[now].f.end()));
    return;
  }
  int mid = (tr[now].l + tr[now].r) >> 1;
  if (pos <= mid)
    update(now << 1, pos, val, type);
  else
    update(now << 1 | 1, pos, val, type);
  push_up(now);
  return;
}
int ansx, ansy;
void query(int now, int pos, int val) {
  if (tr[now].mx <= val) return;
  if (tr[now].l > pos) {
    if (tr[now].l == tr[now].r) {
      ansx = tr[now].l;
      ansy = *tr[now].f.upper_bound(val);
      return;
    }
    query(now << 1, pos, val);
    if (ansx != INF) return;
    query(now << 1 | 1, pos, val);
  } else {
    int mid = (tr[now].l + tr[now].r) >> 1;
    if (pos < mid) query(now << 1, pos, val);
    if (ansx != INF) return;
    query(now << 1 | 1, pos, val);
  }
  return;
}
int n;
int op[maxn], x[maxn], y[maxn], a[maxn];
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    if (s[0] == 'a')
      op[i] = 0;
    else if (s[0] == 'f')
      op[i] = 2;
    else if (s[0] == 'r')
      op[i] = 1;
    cin >> x[i] >> y[i];
    a[i] = x[i];
  }
  sort(a + 1, a + n + 1);
  int m = unique(a + 1, a + n + 1) - a;
  build(1, 1, m - 1);
  for (int i = 1; i <= n; ++i) {
    int xp = lower_bound(a + 1, a + m, x[i]) - a;
    ansx = ansy = INF;
    if (op[i] == 2) {
      query(1, xp, y[i]);
      if (ansx == INF) {
        cout << "-1\n";
      } else
        cout << a[ansx] << " " << ansy << "\n";
    } else {
      update(1, xp, y[i], op[i]);
    }
  }
  return 0;
}
