#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50, INF = 0, MOD = 0;
int n, Mn, cng[4 * N], seg[8 * N];
string s;
set<int> node[8 * N];
vector<pair<int, pair<int, int> > > qu;
vector<int> U;
int get(int t) {
  return ((int)(lower_bound(U.begin(), U.end(), t) - U.begin()) + 1);
}
void add(int ql, int qr, int val, int l = 1, int r = Mn, int id = 1) {
  if (ql >= r || qr <= l) return;
  if (l + 1 == r) {
    node[id].insert(val);
    seg[id] = max(seg[id], val);
    return;
  }
  int mid = (l + r) / 2;
  if (mid >= qr)
    add(ql, qr, val, l, mid, id * 2);
  else
    add(ql, qr, val, mid, r, id * 2 + 1);
  seg[id] = max(seg[id * 2], seg[id * 2 + 1]);
  return;
}
void rmv(int ql, int qr, int val, int l = 1, int r = Mn, int id = 1) {
  if (ql >= r || qr <= l) return;
  if (l + 1 == r) {
    node[id].erase(val);
    if (node[id].size() == 0) {
      seg[id] = 0;
      return;
    }
    auto it = node[id].end();
    it--;
    seg[id] = *it;
    return;
  }
  int mid = (l + r) / 2;
  if (mid >= qr)
    rmv(ql, qr, val, l, mid, id * 2);
  else
    rmv(ql, qr, val, mid, r, id * 2 + 1);
  seg[id] = max(seg[id * 2], seg[id * 2 + 1]);
  return;
}
pair<int, int> get(int ql, int qr, int val, int l = 1, int r = Mn, int id = 1) {
  if (ql >= r || qr <= l) return make_pair(Mn, 0);
  if (seg[id] < val) return make_pair(Mn, 0);
  if (l + 1 == r) {
    auto x = *node[id].lower_bound(val);
    return make_pair(l, x);
  }
  int mid = (l + r) / 2;
  auto u = get(ql, qr, val, l, mid, id * 2);
  if (u.first != Mn) return u;
  return get(ql, qr, val, mid, r, id * 2 + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0, x, y; i < n; i++) {
    cin >> s >> x >> y;
    if (s == "add") qu.push_back(make_pair(0, make_pair(x, y)));
    if (s == "find") qu.push_back(make_pair(2, make_pair(x, y)));
    if (s == "remove") qu.push_back(make_pair(1, make_pair(x, y)));
  }
  for (int i = 0; i < n; i++)
    U.push_back(qu[i].second.first), U.push_back(qu[i].second.second);
  sort(U.begin(), U.end());
  auto it = unique(U.begin(), U.end());
  U.resize(distance(U.begin(), it));
  Mn = (int)U.size() + 1;
  for (int i = 0; i < n; i++) {
    int x = qu[i].second.first;
    qu[i].second.first = get(qu[i].second.first);
    cng[qu[i].second.first] = x;
    x = qu[i].second.second;
    qu[i].second.second = get(qu[i].second.second);
    cng[qu[i].second.second] = x;
  }
  for (int i = 0; i < n; i++) {
    if (qu[i].first == 0)
      add(qu[i].second.first, qu[i].second.first + 1, qu[i].second.second);
    else if (qu[i].first == 1)
      rmv(qu[i].second.first, qu[i].second.first + 1, qu[i].second.second);
    else {
      auto u = get(qu[i].second.first + 1, Mn, qu[i].second.second + 1);
      if (u.first == Mn)
        cout << -1 << '\n';
      else
        cout << cng[u.first] << " " << cng[u.second] << '\n';
    }
  }
  return 0;
}
