#include <bits/stdc++.h>
using namespace std;
struct Tree {
  int l, r, MAX;
};
Tree tree[200010 * 4];
int x[200010], y[200010], xx[200010], yy[200010], idx[200010], idy[200010],
    p[200010];
char s[10];
set<int> S[200010];
int ansx, ansy;
void build(int t, int l, int r) {
  tree[t].l = l, tree[t].r = r, tree[t].MAX = -1;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(t * 2, l, mid);
  build(t * 2 + 1, mid + 1, r);
}
void pushup(int t) { tree[t].MAX = max(tree[t * 2].MAX, tree[t * 2 + 1].MAX); }
void update(int t, int x, int y, int v) {
  if (tree[t].l == tree[t].r) {
    if (v == 1) {
      S[x].insert(y);
      tree[t].MAX = max(tree[t].MAX, y);
    } else {
      S[x].erase(y);
      tree[t].MAX = S[x].empty() ? -1 : *(--S[x].end());
    }
    return;
  }
  int mid = (tree[t].l + tree[t].r) / 2;
  if (x <= mid)
    update(t * 2, x, y, v);
  else
    update(t * 2 + 1, x, y, v);
  pushup(t);
}
void query(int t, int l, int r, int v) {
  if (l <= tree[t].l && tree[t].r <= r) {
    if (tree[t].l == tree[t].r) {
      if (tree[t].MAX > v)
        ansx = tree[t].l, ansy = *S[tree[t].l].lower_bound(v + 1);
      return;
    }
    if (tree[2 * t].MAX > v)
      query(t * 2, l, r, v);
    else if (tree[2 * t + 1].MAX > v)
      query(t * 2 + 1, l, r, v);
    return;
  }
  int mid = (tree[t].l + tree[t].r) / 2;
  if (r <= mid)
    query(t * 2, l, r, v);
  else if (l > mid)
    query(t * 2 + 1, l, r, v);
  else {
    query(t * 2, l, r, v);
    if (ansx == -1) query(t * 2 + 1, l, r, v);
  }
}
int main() {
  int n, X, Y;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s%d%d", s, &x[i], &y[i]);
    xx[i] = x[i];
    yy[i] = y[i];
    if (s[0] == 'a') p[i] = 0;
    if (s[0] == 'r') p[i] = -1;
    if (s[0] == 'f') p[i] = 1;
  }
  sort(xx + 1, xx + n + 1);
  sort(yy + 1, yy + n + 1);
  X = unique(xx + 1, xx + n + 1) - xx - 1;
  Y = unique(yy + 1, yy + n + 1) - yy - 1;
  for (int i = 1; i <= n; i++)
    idx[i] = lower_bound(xx + 1, xx + X + 1, x[i]) - xx;
  for (int i = 1; i <= n; i++)
    idy[i] = lower_bound(yy + 1, yy + Y + 1, y[i]) - yy;
  build(1, 1, X);
  for (int i = 1; i <= n; i++) {
    if (p[i] == 0) update(1, idx[i], idy[i], 1);
    if (p[i] == -1) update(1, idx[i], idy[i], -1);
    if (p[i] == 1) {
      ansx = -1, ansy = -1;
      if (idx[i] < X) query(1, idx[i] + 1, X, idy[i]);
      if (ansx == -1)
        printf("-1\n");
      else
        printf("%d %d\n", xx[ansx], yy[ansy]);
    }
  }
  return 0;
}
