#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
};
inline bool operator<(const point &a, const point &b) {
  return a.x < b.x || (a.x == b.x && a.y < b.y);
}
struct request {
  int type;
  point p;
  request(int type = 0, point p = point(0, 0)) : type(type), p(p.x, p.y) {}
};
int topmost[1 << 20];
vector<point> P;
vector<request> req;
int n;
pair<int, int> res;
void input() {
  char cmd[20];
  int x, y, type;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s%d%d", cmd, &x, &y);
    if (cmd[0] == 'a')
      type = 1;
    else if (cmd[0] == 'r')
      type = 2;
    else
      type = 3;
    req.push_back(request(type, point(x, y)));
    if (type != 3) P.push_back(point(x, y));
  }
  sort(P.begin(), P.end());
  if (P.empty()) P.push_back(point(0, 0));
}
void add(int x, int l, int r, int pos) {
  if (pos < l || r < pos) return;
  if (l == r) {
    topmost[x] = P[pos].y;
  } else {
    if (pos <= (l + r) / 2)
      add(x * 2, l, (l + r) / 2, pos);
    else
      add(x * 2 + 1, (l + r) / 2 + 1, r, pos);
    topmost[x] = max(topmost[x * 2], topmost[x * 2 + 1]);
  }
}
void remove(int x, int l, int r, int pos) {
  if (pos < l || r < pos) return;
  if (l == r) {
    topmost[x] = -1000000000;
  } else {
    if (pos <= (l + r) / 2)
      remove(x * 2, l, (l + r) / 2, pos);
    else
      remove(x * 2 + 1, (l + r) / 2 + 1, r, pos);
    topmost[x] = max(topmost[x * 2], topmost[x * 2 + 1]);
  }
}
void find(int x, int l, int r, point &p) {
  if (P[r].x <= p.x) return;
  if (topmost[x] <= p.y) return;
  if (l == r) {
    if (P[l].x > p.x && P[l].y > p.y) res = make_pair(P[l].x, P[l].y);
  } else {
    find(x * 2, l, (l + r) / 2, p);
    if (res.first == -1000000000) find(x * 2 + 1, (l + r) / 2 + 1, r, p);
  }
}
void solve() {
  for (int i = 0; i < 1 << 19; ++i) topmost[i] = -1000000000;
  int N = P.size() - 1;
  for (int i = 0; i < n; ++i) {
    if (1 == req[i].type) {
      int x = lower_bound(P.begin(), P.end(), req[i].p) - P.begin();
      add(1, 0, N, x);
    } else if (2 == req[i].type) {
      int x = lower_bound(P.begin(), P.end(), req[i].p) - P.begin();
      remove(1, 0, N, x);
    } else {
      res = make_pair(-1000000000, -1000000000);
      find(1, 0, N, req[i].p);
      if (res.first == -1000000000)
        printf("-1\n");
      else
        printf("%d %d\n", res.first, res.second);
    }
  }
}
int main() {
  input();
  solve();
  return 0;
}
