#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > u;
pair<int, int> a[200000];
char str[200005];
int locate(pair<int, int> x) {
  return lower_bound(u.begin(), u.end(), x) - u.begin();
}
class SegTree {
 public:
  int top[524288];
  void modify(int L, int H, int x, int y, int t) {
    if (x + 1 == y) {
      top[t] = H;
      return;
    }
    int m = (x + y) / 2, p = t * 2, q = p + 1;
    if (L < m)
      modify(L, H, x, m, p);
    else
      modify(L, H, m, y, q);
    top[t] = max(top[p], top[q]);
  }
  int getmin(int L, int H, int x, int y, int t) {
    if (top[t] < H || L >= y) return -1;
    if (x + 1 == y) return y - 1;
    int m = (x + y) / 2, p = t * 2, q = p + 1;
    int ret = getmin(L, H, x, m, p);
    return ~ret ? ret : getmin(L, H, m, y, q);
  }
} st;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s%d%d", str + i, &a[i].first, &a[i].second);
    if (str[i] != 'f')
      u.push_back(a[i]);
    else
      a[i].first++, a[i].second++;
  }
  sort(u.begin(), u.end());
  u.erase(unique(u.begin(), u.end()), u.end());
  for (int i = 0; i < n; i++) {
    int t = locate(a[i]);
    if (str[i] == 'a') {
      st.modify(t, u[t].second, 0, u.size(), 1);
    } else if (str[i] == 'r') {
      st.modify(t, 0, 0, u.size(), 1);
    } else {
      t = st.getmin(t, a[i].second, 0, u.size(), 1);
      if (~t)
        printf("%d %d\n", u[t].first, u[t].second);
      else
        puts("-1");
    }
  }
}
