#include <bits/stdc++.h>
using namespace std;
struct mang {
  long op, x, y;
};
mang q[200005];
long X[200005], st[200005 << 2];
long n;
map<long, long> mymap;
set<long> tap[200005];
long lenh(char c) {
  if (c == 'a') return 0;
  if (c == 'r') return 1;
  return 2;
}
void update_tree(long i, long dau, long cuoi, long vt) {
  if (dau == cuoi) {
    st[i] = *(--tap[dau].end());
    return;
  }
  long i1 = (i << 1), i2 = (i1 | 1);
  long giua = (dau + cuoi) >> 1;
  if (vt <= giua)
    update_tree(i1, dau, giua, vt);
  else
    update_tree(i2, giua + 1, cuoi, vt);
  st[i] = ((st[i1]) > (st[i2]) ? (st[i1]) : (st[i2]));
}
long query_tree(long i, long dau, long cuoi, long vt, long val) {
  if (vt > cuoi || st[i] <= val) return -1;
  if (dau == cuoi) return dau;
  long i1 = (i << 1), i2 = (i1 | 1);
  long giua = (dau + cuoi) >> 1;
  long res1 = query_tree(i1, dau, giua, vt, val);
  if (res1 != -1) return res1;
  long res2 = query_tree(i2, giua + 1, cuoi, vt, val);
  if (res2 != -1) return res2;
  return -1;
}
void input() {
  long i, x, y, op, szx, nmax;
  char s[10];
  set<long>::iterator ite;
  scanf("%ld", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %ld %ld", &s, &q[i].x, &q[i].y);
    q[i].op = lenh(s[0]);
    X[i] = q[i].x;
  }
  sort(X, X + n);
  szx = unique(X, X + n) - X;
  for (i = 0; i < szx; i++) tap[i + 1].insert(-1);
  for (i = 0; i < n; i++) {
    x = lower_bound(X, X + szx, q[i].x) - X + 1;
    y = q[i].y;
    op = q[i].op;
    if (op == 0) {
      tap[x].insert(y);
      update_tree(1, 1, szx, x);
    } else if (op == 1) {
      tap[x].erase(tap[x].find(y));
      update_tree(1, 1, szx, x);
    } else {
      x = query_tree(1, 1, szx, x + 1, y);
      if (x == -1)
        printf("-1\n");
      else {
        ite = tap[x].upper_bound(y);
        printf("%ld %ld\n", X[x - 1], *ite);
      }
    }
  }
}
int main() {
  input();
  return 0;
}
