#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int MAXN = 200 * 1000 + 23;
int n, zz[MAXN], cnt, x[MAXN], y[MAXN];
string s[MAXN];
set<pair<int, int> > fen[MAXN];
inline void add(int w, pair<int, int> val, bool q = false) {
  for (int p = w + 1; p; p -= (p & -p))
    if (q)
      fen[p].erase(val);
    else
      fen[p].insert(val);
}
inline void get(int w, int ww) {
  pair<int, int> res = {INT_MAX, INT_MAX};
  for (int p = w + 2; p < MAXN; p += (p & -p)) {
    auto f = fen[p].upper_bound({ww, INT_MAX});
    if (f != fen[p].end()) res = min(res, *f);
  }
  if (res.first != INT_MAX)
    cout << res.first << ' ' << zz[res.second] << '\n';
  else
    cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i] >> x[i] >> y[i];
    zz[i] = y[i];
  }
  sort(zz, zz + n);
  cnt = unique(zz, zz + n) - zz;
  for (int i = 0; i < n; i++) {
    y[i] = lower_bound(zz, zz + cnt, y[i]) - zz;
    if (s[i][0] == 'a') add(y[i], {x[i], y[i]});
    if (s[i][0] == 'r') add(y[i], {x[i], y[i]}, true);
    if (s[i][0] == 'f') get(y[i], x[i]);
  }
  return 0;
}
