#include <bits/stdc++.h>
using namespace std;
int n = 0, q;
string cmd;
int T[200005], X[200005], Y[200005];
set<int> S;
vector<int> comp;
set<int> Set_Y[200005];
int Max[200005 * 4];
int gv(int x) {
  return lower_bound(comp.begin(), comp.end(), x) - comp.begin();
}
void add(int p, int s, int e, int x, int y) {
  if (s == e) {
    Set_Y[x].insert(y);
    auto it = --Set_Y[x].end();
    Max[p] = (*it);
    return;
  }
  int m = (s + e) / 2;
  if (x <= m)
    add(p + p + 1, s, m, x, y);
  else
    add(p + p + 2, m + 1, e, x, y);
  Max[p] = max(Max[p + p + 1], Max[p + p + 2]);
}
void rem(int p, int s, int e, int x, int y) {
  if (s == e) {
    Set_Y[x].erase(Set_Y[x].find(y));
    Max[p] = -1;
    if (Set_Y[x].empty() == 0) {
      auto it = --Set_Y[x].end();
      Max[p] = (*it);
    }
    return;
  }
  int m = (s + e) / 2;
  if (x <= m)
    rem(p + p + 1, s, m, x, y);
  else
    rem(p + p + 2, m + 1, e, x, y);
  Max[p] = max(Max[p + p + 1], Max[p + p + 2]);
}
int rmq(int p, int s, int e, int l, int r, int y) {
  if (s > r || e < l) return -1;
  if (s == e) {
    if (Max[p] > y) {
      return s;
    }
    return -1;
  }
  if (l <= s && e <= r) {
    int m = (s + e) / 2;
    if (Max[p + p + 1] > y) return rmq(p + p + 1, s, m, l, r, y);
    if (Max[p + p + 2] > y) return rmq(p + p + 2, m + 1, e, l, r, y);
    return -1;
  }
  int m = (s + e) / 2;
  int c1 = rmq(p + p + 1, s, m, l, r, y);
  int c2 = rmq(p + p + 2, m + 1, e, l, r, y);
  if (c1 == -1) return c2;
  return c1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> cmd >> X[i] >> Y[i];
    if (cmd == "add")
      T[i] = 0;
    else if (cmd == "remove")
      T[i] = 1;
    else
      T[i] = 2;
    S.insert(X[i]);
  }
  n = S.size();
  for (auto s : S) comp.push_back(s);
  memset(Max, -1, sizeof(Max));
  for (int i = 0; i < q; i++) {
    if (T[i] == 0) {
      int pos_x = gv(X[i]);
      add(0, 0, n - 1, pos_x, Y[i]);
    } else if (T[i] == 1) {
      int pos_x = gv(X[i]);
      rem(0, 0, n - 1, pos_x, Y[i]);
    } else {
      int pos_x = gv(X[i]) + 1;
      if (pos_x == n) {
        cout << -1 << endl;
        continue;
      }
      int x = rmq(0, 0, n - 1, pos_x, n - 1, Y[i]);
      if (x == -1) {
        cout << -1 << endl;
        continue;
      }
      auto it = Set_Y[x].upper_bound(Y[i]);
      cout << comp[x] << " " << (*it) << endl;
    }
  }
  return 0;
}
