#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10, inf = 1e9 + 5;
int input[2][N];
string inputstr[N];
vector<int> num;
inline int getid(int x) {
  return lower_bound(num.begin(), num.end(), x) - num.begin() + 1;
}
int maxy[N * 4];
set<int> ar[N * 4];
inline void pushup(int rt) { maxy[rt] = max(maxy[rt << 1], maxy[rt << 1 | 1]); }
void add(int rt, int tl, int tr, int x, int y) {
  if (tl > x || tr < x) return;
  if (tl == tr && tr == x) {
    ar[rt].insert(y);
    maxy[rt] = max(maxy[rt], y);
    return;
  }
  int mid = (tl + tr) >> 1;
  add(rt << 1, tl, mid, x, y);
  add(rt << 1 | 1, mid + 1, tr, x, y);
  pushup(rt);
}
void rem(int rt, int tl, int tr, int x, int y) {
  if (tl > x || tr < x) return;
  if (tl == tr && tr == x) {
    ar[rt].erase(y);
    if (!ar[rt].empty())
      maxy[rt] = *ar[rt].rbegin();
    else
      maxy[rt] = -1;
    return;
  }
  int mid = (tl + tr) >> 1;
  rem(rt << 1, tl, mid, x, y);
  rem(rt << 1 | 1, mid + 1, tr, x, y);
  pushup(rt);
}
pair<int, int> find(int rt, int tl, int tr, int x, int y) {
  if (tl == tr) {
    return make_pair(tl, *ar[rt].upper_bound(y));
  }
  int mid = (tl + tr) >> 1;
  if (mid > x && maxy[rt << 1] > y) {
    auto k = find(rt << 1, tl, mid, x, y);
    if (k.first >= 0) return k;
  }
  if (maxy[rt << 1 | 1] > y)
    return find(rt << 1 | 1, mid + 1, tr, x, y);
  else
    return make_pair(-1, -1);
}
int main() {
  memset(maxy, -1, sizeof(maxy));
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> inputstr[i] >> input[0][i] >> input[1][i];
    num.push_back(input[0][i]);
    num.push_back(input[1][i]);
  }
  sort(num.begin(), num.end());
  num.erase(unique(num.begin(), num.end()), num.end());
  int m = num.size();
  for (int i = 1; i <= n; i++) {
    if (inputstr[i] == "add") {
      add(1, 1, m, getid(input[0][i]), getid(input[1][i]));
    } else if (inputstr[i] == "remove") {
      rem(1, 1, m, getid(input[0][i]), getid(input[1][i]));
    } else {
      auto ans = find(1, 1, m, getid(input[0][i]), getid(input[1][i]));
      if (ans.first >= 0)
        cout << num[ans.first - 1] << ' ' << num[ans.second - 1] << '\n';
      else
        cout << -1 << '\n';
    }
  }
  return 0;
}
