#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 10, S = 4 * N + 10, INF = 1e9 + 10;
int tq;
pair<int, int> seg[S], zz = {-1, -1};
pair<string, pair<int, int> > q[N];
vector<int> vx, vy;
set<pair<int, int> > st[N];
int gmap(vector<int> &v, int x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
pair<int, int> get(int x, int y, int l = 0, int r = N, int id = 1) {
  if (r <= x) return zz;
  if (r - l == 1) {
    if (!st[l].size()) return zz;
    pair<int, int> ret = *st[l].lower_bound({y, INF});
    return ret;
  }
  int L = id << 1, R = L | 1, m = l + r >> 1;
  pair<int, int> al = zz, ar = zz;
  if (seg[L].first > y) al = get(x, y, l, m, L);
  if (al.first == -1 && seg[R].first > y) ar = get(x, y, m, r, R);
  pair<int, int> ret = max(al, ar);
  return ret;
}
void upd(int x, int y, bool b, int l = 0, int r = N, int id = 1) {
  if (l > x || r <= x) return;
  if (r - l == 1) {
    if (b)
      st[x].insert({y, x});
    else
      st[x].erase({y, x});
    if (!st[x].size())
      seg[id] = zz;
    else
      seg[id] = *st[x].rbegin();
    return;
  }
  int L = id << 1, R = L | 1, m = l + r >> 1;
  upd(x, y, b, l, m, L);
  upd(x, y, b, m, r, R);
  seg[id] = max(seg[L], seg[R]);
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  fill(seg, seg + S, zz);
  cin >> tq;
  for (int i = 0; i < tq; i++) {
    cin >> q[i].first >> q[i].second.first >> q[i].second.second;
    vx.push_back(q[i].second.first);
    vy.push_back(q[i].second.second);
  }
  sort(vx.begin(), vx.end());
  vx.resize(unique(vx.begin(), vx.end()) - vx.begin());
  sort(vy.begin(), vy.end());
  vy.resize(unique(vy.begin(), vy.end()) - vy.begin());
  for (int i = 0; i < tq; i++) {
    int x = q[i].second.first, y = q[i].second.second;
    x = gmap(vx, x);
    y = gmap(vy, y);
    if (q[i].first == "add")
      upd(x, y, 1);
    else if (q[i].first == "remove")
      upd(x, y, 0);
    else {
      pair<int, int> res = get(x + 1, y);
      if (res.first == -1)
        cout << "-1\n";
      else
        cout << vx[res.second] << ' ' << vy[res.first] << '\n';
    }
  }
}
