#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
namespace io {
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x * f;
}
char first[200];
inline void write(int x) {
  if (x == 0) {
    putchar('0');
    return;
  }
  int tmp = x > 0 ? x : -x;
  if (x < 0) putchar('-');
  int cnt = 0;
  while (tmp > 0) {
    first[cnt++] = tmp % 10 + '0';
    tmp /= 10;
  }
  while (cnt > 0) putchar(first[--cnt]);
}
}  // namespace io
using namespace io;
int type[200005], x[200005], y[200005], n, q, m;
set<pair<int, int>> num[200005];
pair<int, int> nm;
void solve1(int &tx, int &ty) {
  int t = ty;
  pair<int, int> p = make_pair(tx, ty);
  while (t) {
    num[t].insert(p);
    t -= t & -t;
  }
}
void solve2(int &tx, int &ty) {
  int t = ty;
  ;
  pair<int, int> p = make_pair(tx, ty);
  while (t) {
    num[t].erase(p);
    t -= t & -t;
  }
}
vector<int> vx, vy;
void solve3(int &tx, int &ty) {
  int t = ty;
  ;
  pair<int, int> p = make_pair(tx, ty);
  pair<int, int> re = make_pair(n, m);
  while (t <= m) {
    re = min(re, *num[t].lower_bound(p));
    t += t & -t;
  }
  if (re == nm) {
    write(-1), putchar('\n');
  } else {
    write(vx[re.first - 1]);
    putchar(' ');
    write(vy[re.second - 1]), putchar('\n');
  }
}
int main() {
  q = read();
  char s[10];
  for (int i = 1; i <= q; i++) {
    scanf("%s", s);
    x[i] = read();
    y[i] = read();
    if (s[0] == 'a')
      type[i] = 1;
    else if (s[0] == 'r')
      type[i] = 2;
    else
      x[i]++, y[i]++, type[i] = 3;
    vx.emplace_back(x[i]);
    vy.emplace_back(y[i]);
  }
  sort(vx.begin(), vx.end());
  vx.erase(unique(vx.begin(), vx.end()), vx.end());
  sort(vy.begin(), vy.end());
  vy.erase(unique(vy.begin(), vy.end()), vy.end());
  for (int i = 1; i <= q; i++) {
    x[i] = lower_bound(vx.begin(), vx.end(), x[i]) - vx.begin() + 1;
    y[i] = lower_bound(vy.begin(), vy.end(), y[i]) - vy.begin() + 1;
  }
  n = vx.size() + 1;
  m = vy.size() + 1;
  nm = make_pair(n, m);
  for (int i = 1; i <= m; i++) num[i].insert(nm);
  for (int i = 1; i <= q; i++) {
    if (type[i] == 1) {
      solve1(x[i], y[i]);
    } else if (type[i] == 2) {
      solve2(x[i], y[i]);
    } else {
      solve3(x[i], y[i]);
    }
  }
  return 0;
}
