#include <bits/stdc++.h>
using namespace std;
int const M = 2e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;
vector<int> ch, ch2;
int s, e, sv;
set<int> xx[M];
int seg[M * 4], to2[M];
string st[M];
int x[M], y[M], hlp;
map<int, int> has, has2;
int to[M];
void update(int l, int r, int ind, int hlpp, int node) {
  if (r - l == 1) {
    seg[node] = hlpp;
    return;
  }
  int mid = (l + r) >> 1;
  if (ind < mid)
    update(l, mid, ind, hlpp, node * 2);
  else
    update(mid, r, ind, hlpp, node * 2 + 1);
  seg[node] = max(seg[node * 2], seg[node * 2 + 1]);
}
void qu(int l, int r, int st, int en, int node) {
  if (s) return;
  if (st <= l && r <= en && seg[node] >= hlp) {
    s = l, e = r;
    sv = node;
    return;
  }
  if (st <= l && r <= en) {
    return;
  }
  if (st >= r || l >= en) return;
  if (s) return;
  int mid = (l + r) >> 1;
  qu(l, mid, st, en, node * 2);
  if (s) return;
  qu(mid, r, st, en, node * 2 + 1);
}
void get(int l, int r, int node) {
  if (r - l == 1) {
    int tmp = *xx[l].lower_bound(hlp);
    printf("%d %d\n", to[l], tmp);
    return;
  }
  int mid = (l + r) >> 1;
  if (seg[node * 2] >= hlp)
    get(l, mid, node * 2);
  else
    get(mid, r, node * 2 + 1);
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> st[i];
    scanf("%d%d", &x[i], &y[i]);
    ch.push_back(x[i]);
  }
  ch.push_back(inf);
  sort(ch.begin(), ch.end());
  int cnt = 0, cnt2 = 0;
  for (int i = 0; i < ch.size(); i++) {
    if (i == 0 || ch[i] != ch[i - 1])
      has[ch[i]] = ++cnt, to[cnt] = ch[i], xx[cnt].insert(-inf);
  }
  for (int i = 1; i <= n; i++) {
    s = 0, e = 0;
    x[i] = has[x[i]];
    if (st[i][0] == 'a') {
      xx[x[i]].insert(y[i]);
      int tmp = *xx[x[i]].rbegin();
      update(1, cnt + 1, x[i], tmp, 1);
    } else if (st[i][0] == 'r') {
      xx[x[i]].erase(y[i]);
      int tmp = *xx[x[i]].rbegin();
      update(1, cnt + 1, x[i], tmp, 1);
    } else {
      x[i]++, y[i]++;
      hlp = y[i];
      qu(1, cnt + 1, x[i], cnt + 1, 1);
      if (!s) {
        printf("%d\n", -1);
        continue;
      }
      get(s, e, sv);
    }
  }
}
