#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const long long LINF = INF * 1ll * INF;
const double PI = acos(-1.0);
using namespace std;
int mx[400005 << 2];
set<int> st[400005];
int a[400005 << 1];
class SegTree {
 public:
  int pos, v;
  bool flag;
  SegTree(int n) { build(1, n, 1); }
  void build(int l, int r, int rt) {
    if (l == r) {
      mx[rt] = -1;
      st[l].clear();
    } else {
      int mid = (l + r) >> 1;
      build(l, mid, rt << 1);
      build(mid + 1, r, rt << 1 | 1);
      mx[rt] = -1;
    }
  }
  void update(int l, int r, int rt) {
    if (l == r) {
      if (flag)
        st[l].insert(v);
      else
        st[l].erase(-v);
      if (st[l].size() == 0)
        mx[rt] = -1;
      else {
        set<int>::const_reverse_iterator it = st[l].rbegin();
        mx[rt] = *it;
      }
    } else {
      int mid = (l + r) >> 1;
      if (pos <= mid)
        update(l, mid, rt << 1);
      else
        update(mid + 1, r, rt << 1 | 1);
      mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);
    }
  }
  int query(int l, int r, int rt) {
    if (l > pos) {
      if (l == r) return mx[rt] > v ? l : -1;
      int mid = (l + r) >> 1;
      if (mx[rt << 1] > v)
        return query(l, mid, rt << 1);
      else if (mx[rt << 1 | 1] > v)
        return query(mid + 1, r, rt << 1 | 1);
      return -1;
    } else {
      int mid = (l + r) >> 1;
      int ans = -1;
      if (pos <= mid && mx[rt << 1] > v) ans = query(l, mid, rt << 1);
      if (ans == -1 && mx[rt << 1 | 1] > v)
        ans = query(mid + 1, r, rt << 1 | 1);
      return ans;
    }
  }
};
struct Query {
  int x, y;
  char c;
} q[400005];
int main(void) {
  int n;
  bool first = true;
  while (scanf("%d", &n) != EOF) {
    if (!first) putchar('\n');
    first = false;
    static int ca = 1;
    char s[10];
    int x = 0;
    for (int i = 0; i < n; i++) {
      scanf("%s", s);
      scanf("%d %d", &q[i].x, &q[i].y);
      q[i].c = s[0];
      a[x++] = q[i].x;
    }
    sort(a, a + x);
    x = unique(a, a + x) - a;
    SegTree seg(x);
    for (int i = 0; i < n; i++) {
      if (q[i].c == 'a') {
        seg.pos = lower_bound(a, a + x, q[i].x) - a + 1;
        seg.v = q[i].y;
        seg.flag = 1;
        seg.update(1, x, 1);
      } else if (q[i].c == 'f') {
        seg.pos = lower_bound(a, a + x, q[i].x) - a + 1;
        seg.v = q[i].y;
        int ans = seg.query(1, x, 1);
        if (ans == -1)
          puts("-1");
        else {
          int ansx = a[ans - 1];
          int ansy = *(st[ans].upper_bound(q[i].y));
          printf("%d %d\n", ansx, ansy);
        }
      } else {
        seg.flag = 0;
        seg.pos = lower_bound(a, a + x, q[i].x) - a + 1;
        seg.v = -q[i].y;
        seg.update(1, x, 1);
      }
    }
  }
}
