#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  char oper[10];
} po[200200], re[200200], ree[200200];
struct Tree {
  int l, r;
  int yy;
  int mid() { return (l + r) >> 1; }
} tree[200200 * 4];
int cnt;
int n;
void build(int l, int r, int v) {
  tree[v].l = l;
  tree[v].r = r;
  if (l == r) {
    tree[v].yy = -1;
    return;
  }
  int mid = tree[v].mid();
  build(l, mid, v << 1);
  build(mid + 1, r, v << 1 | 1);
}
void push_up(int v) {
  tree[v].yy = (tree[v << 1].yy >= tree[v << 1 | 1].yy) ? tree[v << 1].yy
                                                        : tree[v << 1 | 1].yy;
}
void updata(int l, int r, int v, int x, int t) {
  if (l == r) {
    tree[v].yy = t;
    return;
  }
  int mid = tree[v].mid();
  if (x <= mid)
    updata(l, mid, v << 1, x, t);
  else
    updata(mid + 1, r, v << 1 | 1, x, t);
  push_up(v);
}
int query(int l, int r, int v, Point t) {
  if (ree[r].x <= t.x || tree[v].yy <= t.y) return -1;
  if (l == r) return l;
  int mid = tree[v].mid(), ans;
  ans = query(l, mid, v << 1, t);
  if (ans == -1) ans = query(mid + 1, r, v << 1 | 1, t);
  return ans;
}
int cmp(Point A, Point B) {
  if (A.x == B.x)
    return A.y < B.y;
  else
    return A.x < B.x;
}
int main() {
  int i;
  while (scanf("%d", &n) != EOF) {
    cnt = 0;
    for (i = 0; i < n; i++) {
      scanf("%s%d%d", &po[i].oper, &po[i].x, &po[i].y);
      if (po[i].oper[0] == 'a') re[cnt++] = po[i];
    }
    sort(re, re + cnt, cmp);
    int ct = 1;
    ree[0] = re[0];
    for (i = 1; i < cnt; i++) {
      if (re[i].x != re[i - 1].x || re[i].y != re[i - 1].y) ree[ct++] = re[i];
    }
    build(0, ct - 1, 1);
    int ans;
    for (i = 0; i < n; i++) {
      if (po[i].oper[0] == 'a') {
        ans = lower_bound(ree, ree + ct, po[i], cmp) - ree;
        updata(0, ct - 1, 1, ans, ree[ans].y);
      } else if (po[i].oper[0] == 'r') {
        ans = lower_bound(ree, ree + ct, po[i], cmp) - ree;
        updata(0, ct - 1, 1, ans, -1);
      } else {
        ans = query(0, ct - 1, 1, po[i]);
        if (ans != -1)
          printf("%d %d\n", ree[ans].x, ree[ans].y);
        else
          puts("-1");
      }
    }
  }
  return 0;
}
