#include <bits/stdc++.h>
using namespace std;
vector<int> t;
void set_val(int p, int x) {
  t[p + int(t.size()) / 2] = x;
  for (p = (p + int(t.size()) / 2) / 2; p > 0; p /= 2) {
    t[p] = max(t[2 * p], t[2 * p + 1]);
  }
}
int leftmost(int left, int y) {
  if (left >= int(t.size()) / 2) return -1;
  int c = left + int(t.size()) / 2;
  if (t[c] > y) return left;
  for (; c > 1 && !(c % 2 == 0 && t[c + 1] > y);) c /= 2;
  if (c == 1) return -1;
  ++c;
  for (; c < int(t.size()) / 2;) {
    if (t[2 * c] > y)
      c *= 2;
    else
      c = 2 * c + 1;
  }
  return c - int(t.size()) / 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<string> req(n);
  vector<int> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> req[i] >> x[i] >> y[i];
  }
  vector<int> di = x;
  sort(di.begin(), di.end());
  di.resize(unique(di.begin(), di.end()) - di.begin());
  map<int, int> id;
  vector<set<int> > c(di.size());
  for (int i = 0; i < int(di.size()); ++i) {
    id[di[i]] = i;
    c[i].insert(-1);
  }
  int k = 1;
  for (; k < int(di.size());) k *= 2;
  t = vector<int>(2 * k, -1);
  for (int i = 0; i < n; ++i) {
    if (req[i] == "add") {
      c[id[x[i]]].insert(y[i]);
      set<int>::iterator last = c[id[x[i]]].end();
      --last;
      set_val(id[x[i]], *last);
    } else if (req[i] == "remove") {
      c[id[x[i]]].erase(y[i]);
      set<int>::iterator last = c[id[x[i]]].end();
      --last;
      set_val(id[x[i]], *last);
    } else if (req[i] == "find") {
      int a = leftmost(id[x[i]] + 1, y[i]);
      if (a == -1)
        cout << -1 << endl;
      else
        cout << di[a] << " " << *c[a].upper_bound(y[i]) << endl;
    }
  }
}
