#include <bits/stdc++.h>
const int inf = ~0U >> 1, maxn = 200000 + 10;
using namespace std;
int n, m;
struct Index {
  int A[maxn], n;
  int size() { return n; }
  void clear() { n = 0; }
  void add(int x) { A[n++] = x; }
  void doit() {
    sort(A, A + n);
    n = unique(A, A + n) - A;
  }
  inline int get(int v) { return lower_bound(A, A + n, v) - A; }
} IX;
char cmd[100];
struct Action {
  int type, x, y;
  void readin() {
    scanf("%s%d%d", cmd, &x, &y);
    IX.add(x);
    if (cmd[0] == 'a') type = 0;
    if (cmd[0] == 'r') type = 1;
    if (cmd[0] == 'f') type = 2;
  }
} A[maxn];
set<int> S[maxn];
int M(int i) { return *(--S[i].end()); }
int Max[maxn * 3];
void Update(int t) { Max[t] = max(Max[t * 2], Max[t * 2 + 1]); }
void Change(int t, int l, int r, int p) {
  if (p < l || p >= r) return;
  if (l + 1 == r) {
    Max[t] = M(l);
    return;
  }
  Change(t * 2, l, l + r >> 1, p);
  Change(t * 2 + 1, l + r >> 1, r, p);
  Update(t);
}
int Query(int t, int l, int r, int a, int c) {
  if (a >= r || Max[t] <= c) return -1;
  if (l + 1 == r) return l;
  int tmp = Query(t * 2, l, l + r >> 1, a, c);
  if (tmp >= 0) return tmp;
  tmp = Query(t * 2 + 1, l + r >> 1, r, a, c);
  if (tmp >= 0) return tmp;
  return -1;
}
void init() {
  IX.clear();
  for (int i = 0; i < n; i++) A[i].readin();
  IX.doit();
}
void Solve() {
  m = IX.size();
  memset(Max, -1, sizeof Max);
  for (int i = 0; i < m; i++) {
    S[i].clear();
    S[i].insert(-1);
  }
  for (int i = 0; i < n; i++) {
    int x = A[i].x, y = A[i].y;
    x = IX.get(x);
    switch (A[i].type) {
      case 0:
        S[x].insert(y);
        Change(1, 0, m, x);
        break;
      case 1:
        S[x].erase(S[x].find(y));
        Change(1, 0, m, x);
        break;
      case 2:
        int tmp = Query(1, 0, m, x + 1, y);
        if (tmp == -1)
          printf("-1\n");
        else {
          set<int>::iterator it = S[tmp].upper_bound(y);
          printf("%d %d\n", IX.A[tmp], *it);
        }
    }
  }
}
int main() {
  int t = 1;
  while (cin >> n) {
    init();
    Solve();
  }
}
