#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
inline int Max(int a, int b) { return a > b ? a : b; }
const int maxn = 2e5 + 20;
int maxy[maxn << 2], mark[maxn], x[maxn], y[maxn];
set<int> s[maxn];
int n, m;
char op[20];
vector<int> v;
void build(int l, int r, int rt) {
  if (l == r) {
    maxy[rt] = -1;
    return;
  } else {
    int mid = (l + r) >> 1;
    build(l, mid, rt << 1);
    build(mid + 1, r, rt << 1 | 1);
  }
}
void pushup(int rt) { maxy[rt] = Max(maxy[rt << 1], maxy[rt << 1 | 1]); }
void update(int pos, int val, int l, int r, int rt) {
  if (l == r) {
    maxy[rt] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(pos, val, l, mid, rt << 1);
  else
    update(pos, val, mid + 1, r, rt << 1 | 1);
  pushup(rt);
}
int query(int L, int R, int val, int l, int r, int rt) {
  if (maxy[rt] <= val) return -1;
  if (l == r) return l;
  int mid = (l + r) >> 1;
  int ans = -1;
  if (L <= mid && maxy[rt << 1] > val) {
    ans = query(L, R, val, l, mid, rt << 1);
    if (ans != -1) return ans;
  }
  if (R > mid && maxy[rt << 1 | 1] > val)
    ans = query(L, R, val, mid + 1, r, rt << 1 | 1);
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    scanf("%s%d%d", op, &x[i], &y[i]);
    if (op[0] == 'a')
      mark[i] = 1;
    else if (op[0] == 'r')
      mark[i] = 2;
    else
      mark[i] = 3;
    if (op[0] == 'a') v.push_back(x[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  m = v.size();
  for (int i = (0); i < (n); i++) {
    if (mark[i] == 1 || mark[i] == 2) {
      int pos = lower_bound(v.begin(), v.end(), x[i]) - v.begin() + 1;
      if (mark[i] == 1)
        s[pos].insert(y[i]);
      else
        s[pos].erase(y[i]);
      int val;
      if (s[pos].empty())
        val = -INF;
      else
        val = *(--s[pos].end());
      update(pos, val, 1, m, 1);
    } else {
      int pos = upper_bound(v.begin(), v.end(), x[i]) - v.begin() + 1;
      int z = query(pos, m, y[i], 1, m, 1);
      if (z == -1 || pos == m + 1) {
        puts("-1");
        continue;
      }
      int ans = *(s[z].upper_bound(y[i]));
      printf("%d %d\n", v[z - 1], ans);
    }
  }
  return 0;
}
