#include <bits/stdc++.h>
using namespace std;
struct input {
  char str[8];
  int x, y;
  void read() { scanf("%s%d%d", str, &x, &y); }
} IN[200007];
int base[2][200007], basec[2] = {};
void base_add(int x, int p) { base[x][basec[x]++] = p; }
void base_init() {
  for (int i = 0; i < 2; i++) {
    sort(base[i], base[i] + basec[i]);
    basec[i] = unique(base[i], base[i] + basec[i]) - base[i];
  }
}
int base_query(int x, int p) {
  return lower_bound(base[x], base[x] + basec[x], p) - base[x] + 1;
}
int tree[800000];
set<int> pp[200007];
void push_up(int p) { tree[p] = max(tree[p * 2], tree[p * 2 + 1]); }
void build(int p, int l, int r) {
  if (l == r) {
    tree[p] = -1;
    return;
  }
  int m = (l + r) / 2;
  build(p * 2, l, m);
  build(p * 2 + 1, m + 1, r);
  push_up(p);
}
void update(int p, int l, int r, int x, int k) {
  if (l == r) {
    tree[p] = k;
    return;
  }
  int m = (l + r) / 2;
  if (x <= m) update(p * 2, l, m, x, k);
  if (m + 1 <= x) update(p * 2 + 1, m + 1, r, x, k);
  push_up(p);
}
int go(int p, int l, int r, int y) {
  if (l == r) {
    return l;
  }
  int m = (l + r) / 2;
  if (tree[p * 2] > y) return go(p * 2, l, m, y);
  if (tree[p * 2 + 1] > y) return go(p * 2 + 1, m + 1, r, y);
  return 1000000007;
}
int query(int p, int l, int r, int x, int y) {
  if (l > x) {
    if (tree[p] > y)
      return go(p, l, r, y);
    else
      return 1000000007;
  }
  if (x >= r) {
    return 1000000007;
  }
  int m = (l + r) / 2;
  return min(query(p * 2, l, m, x, y), query(p * 2 + 1, m + 1, r, x, y));
}
void add(int x, int y) {
  x = base_query(0, x);
  y = base_query(1, y);
  pp[x].insert(y);
  update(1, 1, basec[0], x, *(pp[x].rbegin()));
}
void rmv(int x, int y) {
  x = base_query(0, x);
  y = base_query(1, y);
  pp[x].erase(y);
  if (pp[x].size() == 0) {
    update(1, 1, basec[0], x, -1);
  } else {
    update(1, 1, basec[0], x, *(pp[x].end()));
  }
}
bool fnd(int x, int y, int &ansx, int &ansy) {
  x = base_query(0, x);
  y = base_query(1, y);
  ansx = query(1, 1, basec[0], x, y);
  if (ansx == 1000000007) {
    return false;
  }
  ansy = *(pp[ansx].upper_bound(y));
  ansx = base[0][ansx - 1];
  ansy = base[1][ansy - 1];
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    IN[i].read();
    base_add(0, IN[i].x);
    base_add(1, IN[i].y);
  }
  base_add(0, 1000000007);
  base_add(1, 1000000007);
  base_init();
  for (int i = 0; i < n; i++) {
    if (IN[i].str[0] == 'a') {
      add(IN[i].x, IN[i].y);
    } else if (IN[i].str[0] == 'r') {
      rmv(IN[i].x, IN[i].y);
    } else if (IN[i].str[0] == 'f') {
      int ax, ay;
      if (fnd(IN[i].x, IN[i].y, ax, ay))
        printf("%d %d\n", ax, ay);
      else
        printf("-1\n");
    }
  }
  return 0;
}
