#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
} ps[200005];
set<int> ys[200005];
int xs[200005], maxCol[200005 * 4], leftRow[200005 * 4];
int n, xn;
char ops[200005];
inline void update(int id, int& l, int& r) {
  if (l == r) return;
  if (maxCol[2 * id + 1] >= maxCol[2 * id + 2]) {
    maxCol[id] = maxCol[2 * id + 1];
    leftRow[id] = leftRow[2 * id + 1];
  } else {
    maxCol[id] = maxCol[2 * id + 2];
    leftRow[id] = leftRow[2 * id + 2];
  }
  if (maxCol[id] == -0x7fffffff) leftRow[id] = -1;
}
void insert(int id, int l, int r, int& pos, int col) {
  if (l == r) {
    maxCol[id] = col;
    if (col == -0x7fffffff)
      leftRow[id] = -1;
    else
      leftRow[id] = l;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    insert(2 * id + 1, l, mid, pos, col);
  else
    insert(2 * id + 2, mid + 1, r, pos, col);
  update(id, l, r);
}
int query(int id, int l, int r, int tl, int tr, int& y) {
  if (maxCol[id] <= y || r < tl || l > tr) return -1;
  if (l == r) return leftRow[id];
  int mid = (l + r) >> 1;
  if (tr <= mid) return query(2 * id + 1, l, mid, tl, tr, y);
  if (tl > mid) return query(2 * id + 2, mid + 1, r, tl, tr, y);
  int k = query(2 * id + 1, l, mid, tl, tr, y);
  if (k != -1) return k;
  return query(2 * id + 2, mid + 1, r, tl, tr, y);
}
int main() {
  int i, j, pos, k, ca;
  set<int>::iterator it;
  char str[10];
  ca = 0;
  scanf("%d", &n);
  for (xn = i = 0; i < n; i++) {
    scanf("%s%d%d", str, &ps[i].x, &ps[i].y);
    ops[i] = str[0];
    if (ops[i] == 'a') {
      xs[xn++] = ps[i].x;
    }
  }
  sort(xs, xs + xn);
  for (ys[0].clear(), j = i = 1; i < xn; i++) {
    if (xs[i] == xs[i - 1]) continue;
    ys[j].clear();
  }
  j = unique(xs, xs + xn) - xs;
  xn = j;
  for (i = 0; i < 4 * xn; i++) maxCol[i] = -0x7fffffff, leftRow[i] = -1;
  for (i = 0; i < n; i++) {
    if (ops[i] == 'a') {
      pos = lower_bound(xs, xs + xn, ps[i].x) - xs;
      if (ys[pos].lower_bound(ps[i].y) == ys[pos].end()) {
        insert(0, 0, xn - 1, pos, ps[i].y);
      }
      ys[pos].insert(ps[i].y);
    } else if (ops[i] == 'r') {
      pos = lower_bound(xs, xs + xn, ps[i].x) - xs;
      it = ys[pos].find(ps[i].y);
      if (it != ys[pos].end()) {
        ys[pos].erase(it);
        if (ys[pos].empty()) {
          insert(0, 0, xn - 1, pos, -0x7fffffff);
          continue;
        }
        it = ys[pos].end();
        it--;
        insert(0, 0, xn - 1, pos, *it);
      }
    } else {
      pos = lower_bound(xs, xs + xn, ps[i].x + 1) - xs;
      if (pos < 0 || pos >= xn) {
        printf("-1\n");
        continue;
      }
      k = query(0, 0, xn - 1, pos, xn - 1, ps[i].y);
      if (k == -1) {
        printf("-1\n");
      } else {
        it = ys[k].lower_bound(ps[i].y + 1);
        printf("%d %d\n", xs[k], *it);
      }
    }
  }
  return 0;
}
