#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
set<pair<int, int> >::iterator it;
struct segment {
  int sil, mi;
  set<pair<int, int> > val[1000000];
  inline void build(int ss) {
    mi = 1;
    while (mi <= ss) mi *= 2;
    for (int i = 1; i <= mi * 2; i++) {
      val[i].clear();
      val[i].insert(make_pair(inf, inf));
    }
  }
  inline void edit(int pos, int va) {
    int tx = pos;
    while (pos != 0) {
      val[pos].insert(make_pair(va, tx));
      pos -= (pos & (-pos));
    }
  }
  inline void dele(int pos, int va) {
    int tx = pos;
    while (pos != 0) {
      val[pos].erase(make_pair(va, tx));
      pos -= (pos & (-pos));
    }
  }
  inline pair<int, int> search(int pos, int va) {
    pair<int, int> ss = make_pair(inf, inf);
    while (pos <= sil) {
      it = val[pos].upper_bound(make_pair(va, inf));
      ss = min(ss, (*it));
      pos += (pos & (-pos));
    }
    return ss;
  }
} sgt;
int n, a[250000][2];
int lsh[250000];
int lsx, lsy;
int opt[250000];
int alsx[250000];
int alsy[250000];
char str[220];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str + 1);
    if (str[1] == 'a')
      opt[i] = 1;
    else if (str[1] == 'r')
      opt[i] = 2;
    else
      opt[i] = 3;
    scanf("%d %d", &a[i][0], &a[i][1]);
  }
  for (int i = 1; i <= n; i++) {
    lsh[i] = a[i][0];
  }
  sort(lsh + 1, lsh + n + 1);
  lsx = unique(lsh + 1, lsh + n + 1) - lsh - 1;
  for (int i = 1; i <= n; i++) {
    alsx[i] = lsh[i];
    a[i][0] = lower_bound(lsh + 1, lsh + lsx + 1, a[i][0]) - lsh;
  }
  for (int i = 1; i <= n; i++) {
    lsh[i] = a[i][1];
  }
  sort(lsh + 1, lsh + n + 1);
  lsy = unique(lsh + 1, lsh + n + 1) - lsh - 1;
  for (int i = 1; i <= n; i++) {
    alsy[i] = lsh[i];
    a[i][1] = lower_bound(lsh + 1, lsh + lsy + 1, a[i][1]) - lsh;
  }
  sgt.build(lsy);
  sgt.sil = lsy;
  for (int i = 1; i <= n; i++) {
    if (opt[i] == 1) {
      sgt.edit(a[i][1], a[i][0]);
    } else if (opt[i] == 2) {
      sgt.dele(a[i][1], a[i][0]);
    } else {
      pair<int, int> res = sgt.search(a[i][1] + 1, a[i][0]);
      if (res.first == inf)
        printf("-1\n");
      else
        printf("%d %d\n", alsx[res.first], alsy[res.second]);
    }
  }
  return 0;
}
