#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000;
int n, m, N;
int op[maxn], ax[maxn], ay[maxn], x[maxn];
char ch[10];
int maxv[maxn + maxn], leftSide[maxn + maxn], rightSide[maxn + maxn];
int find(int l, int r, int v, int root) {
  if (maxv[root] <= v) return -1;
  if (leftSide[root] > r) return -1;
  if (rightSide[root] < l) return -1;
  if (leftSide[root] == rightSide[root]) {
    return root - N;
  }
  int tt = find(l, r, v, root + root);
  if (tt != -1) return tt;
  tt = find(l, r, v, root + root + 1);
  if (tt != -1) return tt;
  return -1;
}
void update(int root, int v) {
  maxv[N + root] = v;
  root += N;
  while (root > 1) {
    int fa = root / 2;
    maxv[fa] = max(maxv[fa + fa], maxv[fa + fa + 1]);
    root = fa;
  }
}
multiset<int, greater<int> > T[maxn];
multiset<int, greater<int> >::iterator it;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s %d %d", ch, &ax[i], &ay[i]);
    x[i] = ax[i];
    if (ch[0] == 'a')
      op[i] = 0;
    else if (ch[0] == 'r')
      op[i] = 1;
    else
      op[i] = 2;
  }
  sort(x, x + n);
  m = unique(x, x + n) - x;
  N = 1;
  while (N < m) N += N;
  for (int i = N; i < N + N; i++) {
    maxv[i] = 0;
    leftSide[i] = rightSide[i] = i - N;
  }
  for (int i = N - 1; i > 0; i--) {
    maxv[i] = max(maxv[i + i], maxv[i + i + 1]);
    leftSide[i] = leftSide[i + i];
    rightSide[i] = rightSide[i + i + 1];
  }
  for (int i = 0; i < n; i++) {
    if (op[i] == 0) {
      int tx = lower_bound(x, x + m, ax[i]) - x;
      if (ay[i] > maxv[tx + N]) {
        update(tx, ay[i]);
      }
      T[tx].insert(ay[i]);
    } else if (op[i] == 1) {
      int tx = lower_bound(x, x + m, ax[i]) - x;
      it = T[tx].lower_bound(ay[i]);
      T[tx].erase(it);
      it = T[tx].begin();
      int v = 0;
      if (it != T[tx].end() && (*it) > v) {
        v = (*it);
      }
      update(tx, v);
    } else {
      int tx = lower_bound(x, x + m, ax[i]) - x;
      if (tx < m && x[tx] == ax[i]) tx++;
      if (tx == m) {
        printf("-1\n");
        continue;
      }
      int tt = find(tx, m - 1, ay[i], 1);
      if (tt == -1) {
        printf("-1\n");
        continue;
      }
      it = T[tt].lower_bound(ay[i]);
      if (*it <= ay[i] || it == T[tt].end()) --it;
      printf("%d %d\n", x[tt], *it);
    }
  }
  return 0;
}
