#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400040;
struct tNode {
  int left, right, mh;
} tr[MAXN << 2];
pair<int, int> ar[MAXN >> 1];
int op[MAXN][3];
void build(int t, int l, int r) {
  tr[t].left = l, tr[t].right = r;
  tr[t].mh = 0;
  if (l == r) {
  } else {
    int mid = (l + r) >> 1;
    build(t << 1, l, mid);
    build((t << 1) | 1, mid + 1, r);
  }
}
void updata(int t, int p, int v) {
  if (tr[t].left == p && tr[t].right == p) {
    tr[t].mh = v;
  } else {
    int mid = (tr[t].left + tr[t].right) >> 1;
    if (p <= mid)
      updata(t << 1, p, v);
    else
      updata((t << 1) | 1, p, v);
    tr[t].mh = max(tr[t << 1].mh, tr[(t << 1) | 1].mh);
  }
}
int find(int t, int l, int r, int y) {
  if (tr[t].mh <= y || l > r) return -1;
  if (tr[t].left == tr[t].right) {
    return tr[t].left;
  }
  int mid = (tr[t].left + tr[t].right) >> 1;
  if (l <= mid) {
    int tmp = find(t << 1, l, mid, y);
    if (tmp != -1) return tmp;
    return find((t << 1) | 1, mid + 1, r, y);
  } else {
    return find((t << 1) | 1, l, r, y);
  }
}
int main() {
  char buf[18];
  int n, l = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s %d %d", buf, &op[i][1], &op[i][2]);
    if (buf[0] == 'a') {
      op[i][0] = 1;
      ar[l].first = op[i][1];
      ar[l++].second = op[i][2];
    } else if (buf[0] == 'f')
      op[i][0] = 2;
    else
      op[i][0] = 0;
  }
  sort(ar, ar + l);
  l = unique(ar, ar + l) - ar;
  if (l != 0) build(1, 0, l - 1);
  for (int i = 0; i < n; ++i) {
    if (op[i][0] == 1) {
      int p = lower_bound(ar, ar + l, make_pair(op[i][1], op[i][2])) - ar;
      updata(1, p, op[i][2]);
    } else if (op[i][0]) {
      int p =
          lower_bound(ar, ar + l, make_pair(op[i][1] + 1, op[i][2] + 1)) - ar;
      if (p == l) {
        printf("-1\n");
        continue;
      }
      int res = find(1, p, l - 1, op[i][2]);
      if (res == -1) {
        printf("-1\n");
      } else {
        printf("%d %d\n", ar[res].first, ar[res].second);
      }
    } else {
      int p = lower_bound(ar, ar + l, make_pair(op[i][1], op[i][2])) - ar;
      updata(1, p, 0);
    }
  }
  return 0;
}
