#include <bits/stdc++.h>
using namespace std;
constexpr int N = 2e5 + 10;
constexpr int INF = 1e9 + 10;
int n, mapper, rev[N], x, y, tree[4 * N];
vector<int> vec;
set<int> point[N];
string type;
vector<pair<string, pair<int, int>>> q;
void add(int b, int e, int p, int val, int idx) {
  if (b > p || e <= p) return;
  if (b + 1 == e) {
    tree[idx] = max(tree[idx], val);
    return;
  }
  int mid = (b + e) >> 1, lidx = idx << 1, ridx = lidx | 1;
  add(b, mid, p, val, lidx);
  add(mid, e, p, val, ridx);
  tree[idx] = max(tree[lidx], tree[ridx]);
}
void rem(int b, int e, int p, int idx) {
  if (b > p || e <= p) return;
  if (b + 1 == e) {
    tree[idx] = 0;
    if ((int)point[b].size()) tree[idx] = *(--point[b].end());
    return;
  }
  int mid = (b + e) >> 1, lidx = idx << 1, ridx = lidx | 1;
  rem(b, mid, p, lidx);
  rem(mid, e, p, ridx);
  tree[idx] = max(tree[lidx], tree[ridx]);
}
int get2(int b, int e, int l, int r, int idx) {
  if (b >= r || e <= l) return 0;
  if (b >= l && e <= r) return tree[idx];
  int mid = (b + e) >> 1, lidx = idx << 1, ridx = lidx | 1;
  return max(get2(b, mid, l, r, lidx), get2(mid, e, l, r, ridx));
}
pair<int, int> get(int b, int e, int l, int r, int val, int idx) {
  if (b >= r || e <= l) return {-INF, 0};
  if (b >= l && e <= r && tree[idx] < val) return {-INF, 0};
  if (b + 1 == e) return {*point[b].lower_bound(val), b};
  int mid = (b + e) >> 1, lidx = idx << 1, ridx = lidx | 1;
  if (l >= mid) return get(mid, e, l, r, val, ridx);
  if (r <= mid) return get(b, mid, l, r, val, lidx);
  if (get2(0, mapper, l, mid, 1) >= val) return get(b, mid, l, r, val, lidx);
  return get(mid, e, l, r, val, ridx);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> type >> x >> y;
    vec.push_back(x);
    q.push_back({type, {x, y}});
  }
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  for (int i = 0; i < n; i++)
    q[i].second.first =
        lower_bound(vec.begin(), vec.end(), q[i].second.first) - vec.begin();
  mapper = (int)vec.size();
  for (int i = 0; i < n; i++) {
    if (q[i].first == "add") {
      add(0, mapper, q[i].second.first, q[i].second.second, 1);
      point[q[i].second.first].insert(q[i].second.second);
    } else if (q[i].first == "remove") {
      point[q[i].second.first].erase(q[i].second.second);
      rem(0, mapper, q[i].second.first, 1);
    } else {
      if (get2(0, mapper, q[i].second.first + 1, mapper, 1) <=
          q[i].second.second) {
        cout << -1 << '\n';
        continue;
      }
      pair<int, int> ans = get(0, mapper, q[i].second.first + 1, mapper,
                               q[i].second.second + 1, 1);
      if (ans.first == -INF)
        cout << -1 << '\n';
      else
        cout << vec[ans.second] << ' ' << ans.first << '\n';
    }
  }
  return 0;
}
