#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int tree[2 * 400005];
multiset<int> s[400005];
int n = 400005 - 1;
int h[400005];
void add(int p, int val) {
  for (tree[p += n] = val; p > 1; p >>= 1)
    tree[p >> 1] = max(tree[p], tree[p ^ 1]);
}
bool find(int l, int val, int r) {
  int x = l, y = val;
  l += n;
  r += n;
  int ans = 0;
  while (l < r) {
    if (l & 1) {
      ans = max(ans, tree[l++]);
    }
    if (r & 1) {
      ans = max(ans, tree[--r]);
    }
    l >>= 1;
    r >>= 1;
  }
  return ans >= val;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int q;
  cin >> q;
  string sq[q];
  vector<int> v;
  int l[q], r[q];
  for (int i = 0; i < q; i++) {
    cin >> sq[i] >> l[i] >> r[i];
    v.push_back(l[i]);
    v.push_back(r[i]);
  }
  v.push_back(-1);
  sort(v.begin(), v.end());
  int k = 1;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] == v[i - 1]) continue;
    h[k] = v[i];
    mp[v[i]] = k++;
  }
  for (int i = 0; i < 400005; i++) {
    s[i].insert(0);
  }
  for (int i = 0; i < q; i++) {
    int x = mp[l[i]];
    int y = mp[r[i]];
    if (sq[i] == "add") {
      s[x].insert(-y);
      add(x, -*s[x].begin());
    } else if (sq[i] == "remove") {
      s[x].erase(s[x].lower_bound(-y));
      add(x, -*s[x].begin());
    } else {
      int low = x + 1, high = n - 2, mid;
      while (low < high) {
        int mid = (low + high) / 2;
        if (!find(x + 1, y + 1, mid + 1)) {
          low = mid + 1;
        } else {
          high = mid;
        }
      }
      if (low == n - 2) {
        cout << -1 << '\n';
      } else {
        multiset<int>::iterator itr = s[low].lower_bound(-y);
        itr--;
        cout << h[low] << " " << h[-*itr] << '\n';
      }
    }
  }
}
