#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e10;
const int N = 2e5 + 77;
long long tree[4 * N];
string type[N];
vector<long long> v;
map<long long, long long> assign, rev_assign;
multiset<long long> store[N];
struct point {
  long long x, y;
  point() {
    x = 0;
    y = 0;
  }
} query[N];
void build(long long node, long long a, long long b) {
  if (a == b) {
    tree[node] = -inf;
    return;
  }
  long long mid = (a + b) / 2;
  build(2 * node, a, mid);
  build(2 * node + 1, mid + 1, b);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
void update(long long node, long long a, long long b, long long ind,
            long long val) {
  if (a > b || a > ind || b < ind) return;
  if (a == b) {
    tree[node] = val;
    return;
  }
  long long mid = (a + b) / 2;
  update(2 * node, a, mid, ind, val);
  update(2 * node + 1, mid + 1, b, ind, val);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
long long get(long long node, long long a, long long b, long long l,
              long long r, long long val) {
  if (a > b || a > r || b < l || tree[node] <= val) return -1;
  if (a == b) return a;
  long long mid = (a + b) / 2;
  long long ans = get(2 * node, a, mid, l, r, val);
  if (ans != -1) return ans;
  return get(2 * node + 1, mid + 1, b, l, r, val);
}
int main() {
  long long i, j, n, x, y, ctr = 0, hi, lo, mid;
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    cin >> type[i];
    scanf("%I64d%I64d", &query[i].x, &query[i].y);
    v.push_back(query[i].x);
  }
  ctr = 0;
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++) {
    if (!assign[v[i]]) {
      ctr++;
      assign[v[i]] = ctr;
      rev_assign[ctr] = v[i];
    }
  }
  for (i = 1; i <= n; i++) query[i].x = assign[query[i].x];
  build(1, 1, ctr);
  for (i = 1; i <= n; i++) {
    if (type[i] == "add") {
      x = query[i].x;
      y = query[i].y;
      store[x].insert(y);
      update(1, 1, ctr, x, *store[x].rbegin());
    } else if (type[i] == "remove") {
      x = query[i].x;
      y = query[i].y;
      store[x].erase(store[x].find(y));
      if (!store[x].size())
        update(1, 1, ctr, x, -inf);
      else
        update(1, 1, ctr, x, *store[x].rbegin());
    } else {
      x = query[i].x;
      y = query[i].y;
      hi = get(1, 1, ctr, x + 1, ctr, y);
      if (hi == -1) {
        cout << "-1" << endl;
        continue;
      }
      printf("%I64d %I64d\n", rev_assign[hi], (*store[hi].upper_bound(y)));
    }
  }
  return 0;
}
