#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double PI = acos((long double)-1.0);
const int INF = 1 << 30;
const long long LINF = 1ll << 61;
const int BUFFER_SZ = 1 << 20;
const int MOD = 1000 * 1000 * 1000 + 7;
char BUFFER[BUFFER_SZ];
int gi() {
  int x;
  scanf("%d", &x);
  return x;
}
double gd() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long gll() {
  long long x;
  cin >> x;
  return x;
}
vector<int> gvi(int n) {
  vector<int> a;
  while (n-- > 0) a.push_back(gi());
  return a;
}
string gs() {
  scanf("%s", BUFFER);
  return string(BUFFER);
}
template <class T>
void print(vector<T> &x, string format) {
  format += "%c";
  for (int i = 0; i < x.size(); ++i)
    printf(format.c_str(), x[i], i + 1 == x.size() ? '\n' : ' ');
}
set<int> T[200100];
int Tmax[200100 * 4];
vector<pair<int, pair<int, int>>> REQ;
void add(int v, int L, int R, int x, int val) {
  if (L == R) {
    T[L].insert(val);
    Tmax[v] = max(Tmax[v], val);
  } else {
    int m = (L + R) >> 1;
    if (x <= m) {
      add(v << 1, L, m, x, val);
    } else {
      add(v << 1 | 1, m + 1, R, x, val);
    }
    Tmax[v] = max(Tmax[v << 1], Tmax[v << 1 | 1]);
  }
}
void rem(int v, int L, int R, int x, int val) {
  if (L == R) {
    T[L].erase(val);
    Tmax[v] = T[L].size() ? *(--T[L].end()) : -1;
  } else {
    int m = (L + R) >> 1;
    if (x <= m) {
      rem(v << 1, L, m, x, val);
    } else {
      rem(v << 1 | 1, m + 1, R, x, val);
    }
    Tmax[v] = max(Tmax[v << 1], Tmax[v << 1 | 1]);
  }
}
int find(int v, int L, int R, int l, int r, int y) {
  if (Tmax[v] <= y) return 0;
  if (L == l && R == r) {
    return Tmax[v] > y ? 1 : 0;
  }
  int m = (L + R) >> 1;
  int res = -1;
  if (l <= m) res = max(res, find(v << 1, L, m, l, min(r, m), y));
  if (r > m) res = max(res, find(v << 1 | 1, m + 1, R, max(m + 1, l), r, y));
  return res;
}
void view(int v, int L, int R) {
  printf("[%d, %d]{", L, R);
  for (int x : T[v]) printf("%d,", x);
  printf("}\n");
  if (L >= R) return;
  int m = (L + R) >> 1;
  view(v << 1, L, m);
  view(v << 1 | 1, m + 1, R);
}
int X[200200];
int Xn = 0;
int Y[200200];
int Yn = 0;
void solve() {
  int n = gi();
  for (int i = 0; i < n; ++i) {
    string o = gs();
    int x = gi();
    int y = gi();
    if (o == "add") {
      REQ.push_back(make_pair(1, make_pair(x, y)));
    } else if (o == "remove") {
      REQ.push_back(make_pair(0, make_pair(x, y)));
    } else if (o == "find") {
      REQ.push_back(make_pair(3, make_pair(x, y)));
    }
    X[Xn++] = x;
    Y[Yn++] = y;
  }
  sort(X, X + Xn);
  Xn = unique(X, X + Xn) - X;
  sort(Y, Y + Yn);
  Yn = unique(Y, Y + Yn) - Y;
  for (int i = 0; i < n; ++i) {
    int x = lower_bound(X, X + Xn, REQ[i].second.first) - X;
    int y = lower_bound(Y, Y + Yn, REQ[i].second.second) - Y;
    if (REQ[i].first == 0) {
      rem(1, 0, Xn - 1, x, y);
    } else if (REQ[i].first == 1) {
      add(1, 0, Xn - 1, x, y);
    } else {
      int l = x + 1;
      int r = Xn - 1;
      int res = -1;
      while (l <= r) {
        int m = (l + r) >> 1;
        if (find(1, 0, Xn - 1, l, m, y)) {
          res = m;
          r = m - 1;
        } else {
          l = m + 1;
        }
      }
      if (res != -1) {
        int xr = res;
        int yr = *T[xr].upper_bound(y);
        printf("%d %d\n", X[xr], Y[yr]);
      } else {
        printf("-1\n");
      }
    }
  }
}
int main() {
  solve();
  return 0;
}
