#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T& a) {
  return (int)a.size();
}
template <class T>
T sqr(const T& a) {
  return a * a;
}
char s[20];
struct Req {
  int x, y;
  int type;
  void scan() {
    scanf("%s %d %d", s, &x, &y);
    if (s[0] == 'a') {
      type = 0;
    } else if (s[0] == 'r') {
      type = 1;
    } else {
      x++;
      y++;
      type = 2;
    }
  }
} r[210000];
int x[210000];
set<pair<int, int> > b;
int a[524288];
void Add(int x, int y) {
  int i = x + 262144;
  for (; i; i >>= 1) {
    a[i] = max(a[i], y);
  }
}
void Remove(int x, int y) {
  int i = x + 262144;
  set<pair<int, int> >::iterator it = b.find(make_pair(x, y));
  if (a[i] == y) {
    if (it == b.begin()) {
      a[i] = -1;
    } else {
      it--;
      if (it->first == x) {
        a[i] = it->second;
      } else {
        a[i] = -1;
      }
    }
  }
  for (i >>= 1; i; i >>= 1) {
    a[i] = max(a[i + i], a[i + i + 1]);
  }
}
int n;
int rx, ry;
bool Find(int i, int d, int u, int x, int y) {
  if (a[i] < y) return 0;
  if (u < x) return 0;
  if (d == u) {
    rx = d;
    { ry = b.lower_bound(make_pair(rx, y))->second; }
    return 1;
  }
  int p = (d + u) / 2;
  if (Find(i + i, d, p, x, y)) return true;
  return Find(i + i + 1, p + 1, u, x, y);
}
int main() {
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    r[i].scan();
    x[i] = r[i].x;
  }
  sort(x, x + m);
  memset(a, -1, sizeof(a));
  n = unique(x, x + m) - x;
  for (int i = 0; i < m; i++) {
    r[i].x = lower_bound(x, x + n, r[i].x) - x;
  }
  for (int i = 0; i < m; i++) {
    switch (r[i].type) {
      case 0:
        b.insert(make_pair(r[i].x, r[i].y));
        Add(r[i].x, r[i].y);
        break;
      case 1:
        Remove(r[i].x, r[i].y);
        b.erase(make_pair(r[i].x, r[i].y));
        break;
      case 2:
        if (Find(1, 0, 262143, r[i].x, r[i].y)) {
          printf("%d %d\n", x[rx], ry);
        } else {
          printf("-1\n");
        }
        break;
    }
  }
  return 0;
}
