#include <bits/stdc++.h>
using namespace std;
const int N = 200011;
set<int> K[N];
struct rec {
  int opt, x, y;
} q[N];
int w[N << 2], Q, m, b[N], mx[N], ans;
inline signed iut() {
  register int ans = 0;
  register char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) ans = (ans << 3) + (ans << 1) + (c ^ 48), c = getchar();
  return ans;
}
inline void print(int ans) {
  if (ans > 9) print(ans / 10);
  putchar(ans % 10 + 48);
}
inline void update(int k, int l, int r, int x, int y) {
  if (l == r) {
    w[k] = y;
    return;
  }
  register int mid = (l + r) >> 1;
  if (x <= mid)
    update(k << 1, l, mid, x, y);
  else
    update(k << 1 | 1, mid + 1, r, x, y);
  w[k] = max(w[k << 1], w[k << 1 | 1]);
}
inline void query(int k, int l, int r, int x, int y) {
  if (r < x) return;
  if (l == r) {
    if (w[k] >= y) ans = l;
    return;
  }
  register int mid = (l + r) >> 1;
  if (w[k << 1] >= y) query(k << 1, l, mid, x, y);
  if (~ans) return;
  if (w[k << 1 | 1] >= y) query(k << 1 | 1, mid + 1, r, x, y);
}
signed main() {
  Q = iut();
  for (register int i = 1; i <= Q; ++i) {
    register char c = getchar();
    while (!isalpha(c)) c = getchar();
    register int x = iut() + 1, y = iut() + 1;
    if (c == 'f')
      q[i] = (rec){2, ++x, ++y};
    else
      q[i] = (rec){c == 'r', x, y};
    b[++m] = x;
  }
  sort(b + 1, b + 1 + m), m = unique(b + 1, b + 1 + m) - b - 1;
  for (register int i = 1; i <= Q; ++i) {
    q[i].x = lower_bound(b + 1, b + 1 + m, q[i].x) - b;
    if (!q[i].opt) {
      if (q[i].y > mx[q[i].x]) {
        update(1, 1, m, q[i].x, q[i].y), mx[q[i].x] = q[i].y;
      }
      K[q[i].x].insert(q[i].y);
    } else if (q[i].opt == 1) {
      K[q[i].x].erase(q[i].y);
      if (mx[q[i].x] == q[i].y) {
        if (!K[q[i].x].empty())
          mx[q[i].x] = *(--K[q[i].x].end());
        else
          mx[q[i].x] = 0;
        update(1, 1, m, q[i].x, mx[q[i].x]);
      }
    } else {
      ans = -1, query(1, 1, m, q[i].x, q[i].y);
      if (ans == -1)
        printf("-1");
      else {
        print(b[ans] - 1), putchar(32);
        print((*K[ans].lower_bound(q[i].y)) - 1);
      }
      putchar(10);
    }
  }
  return 0;
}
