#include <bits/stdc++.h>
using namespace std;
struct node {
  char ch[20];
  int x, y;
};
node a[200005];
int n, m;
int lisan[200005];
int maxy[1000005];
set<int> x[200005];
void build(int l, int r, int k) {
  maxy[k] = -1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(l, mid, 2 * k);
  build(mid + 1, r, 2 * k + 1);
}
void updata(int l, int r, int k, int pos) {
  if (l == r) {
    if (x[pos].size())
      maxy[k] = *(--x[pos].end());
    else
      maxy[k] = -1;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos > mid)
    updata(mid + 1, r, 2 * k + 1, pos);
  else
    updata(l, mid, 2 * k, pos);
  maxy[k] = max(maxy[2 * k], maxy[2 * k + 1]);
}
int work(int l, int r, int k, int L, int R, int VAL) {
  if ((maxy[k] <= VAL) || (L > R)) return -1;
  if (l == r) return l;
  int mid = (l + r) >> 1;
  if (R <= mid)
    return work(l, mid, 2 * k, L, R, VAL);
  else if (L > mid)
    return work(mid + 1, r, 2 * k + 1, L, R, VAL);
  else {
    int t = work(l, mid, 2 * k, L, mid, VAL);
    if (t != -1)
      return t;
    else
      return work(mid + 1, r, 2 * k + 1, mid + 1, R, VAL);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s%d%d", a[i].ch, &a[i].x, &a[i].y);
    lisan[i] = a[i].x;
  }
  sort(lisan, lisan + n);
  m = unique(lisan, lisan + n) - lisan;
  build(0, m - 1, 1);
  for (int i = 0; i < m; i++) x[i].clear();
  for (int i = 0; i < n; i++) {
    int pos = lower_bound(lisan, lisan + m, a[i].x) - lisan;
    if (a[i].ch[0] == 'a') {
      x[pos].insert(a[i].y);
      updata(0, m - 1, 1, pos);
    } else {
      if (a[i].ch[0] == 'r') {
        x[pos].erase(a[i].y);
        updata(0, m - 1, 1, pos);
      } else {
        int ans = work(0, m - 1, 1, pos + 1, m - 1, a[i].y);
        if (ans == -1)
          printf("-1\n");
        else
          printf("%d %d\n", lisan[ans], (*x[ans].upper_bound(a[i].y)));
      }
    }
  }
  return 0;
}
