#include <bits/stdc++.h>
using namespace std;
const int MN = 2e5 + 100;
const int INF = 1e9 + 10;
struct triple {
  int fir, sec, thir;
};
char ord[MN][4];
int x[MN], y[MN];
map<int, int> mp;
set<int> st, S[MN];
int X[MN];
triple first;
int q;
int seg[4 * MN];
void input() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  scanf("%d\n", &q);
  for (int i = 0; i < q; ++i) {
    scanf("%s %d %d\n", ord[i], &x[i], &y[i]);
    if (ord[i][0] != 'f') st.insert(x[i]);
  }
}
void prep() {
  int counter = 0;
  set<int>::iterator it;
  for (it = st.begin(); it != st.end(); ++it) {
    X[counter] = *it;
    mp[*it] = counter++;
  }
  for (int i = 0; i < MN; ++i) S[i].insert(-INF);
}
void upd(const int &segnum, const int &left, const int &right, const int &ind) {
  if (ind < left || right < ind) return;
  if (left == right) {
    seg[segnum] = *S[ind].rbegin();
    return;
  }
  int mid = (left + right) / 2;
  upd(2 * segnum, left, mid, ind);
  upd(2 * segnum + 1, mid + 1, right, ind);
  seg[segnum] = max(seg[2 * segnum], seg[2 * segnum + 1]);
}
void makefirst(const int &segnum, const int &left, const int &right,
               const int &l, const int &r, const int &bound) {
  if (r < left || right < l) return;
  if (l <= left && right <= r) {
    if (seg[segnum] > bound && first.fir == -1)
      first.fir = segnum, first.sec = left, first.thir = right;
    return;
  }
  int mid = (left + right) / 2;
  makefirst(2 * segnum, left, mid, l, r, bound);
  makefirst(2 * segnum + 1, mid + 1, right, l, r, bound);
}
int find(const int &segnum, const int &left, const int &right,
         const int &bound) {
  if (left == right) return left;
  int mid = (left + right) / 2;
  if (seg[2 * segnum] > bound)
    return find(2 * segnum, left, mid, bound);
  else
    return find(2 * segnum + 1, mid + 1, right, bound);
}
void output() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  st.clear();
  for (int i = 0; i < q; ++i) {
    first.fir = -1;
    if (ord[i][0] == 'a') {
      S[mp[x[i]]].insert(y[i]);
      st.insert(x[i]);
      upd(1, 0, mp.size() - 1, mp[x[i]]);
    } else if (ord[i][0] == 'r') {
      S[mp[x[i]]].erase(y[i]);
      st.erase(x[i]);
      upd(1, 0, mp.size() - 1, mp[x[i]]);
    } else {
      if (st.upper_bound(x[i]) == st.end()) {
        printf("-1\n");
        continue;
      }
      int up = mp[*st.upper_bound(x[i])];
      makefirst(1, 0, mp.size() - 1, up, mp.size() - 1, y[i]);
      if (first.fir == -1) {
        printf("-1\n");
        continue;
      }
      int t = find(first.fir, first.sec, first.thir, y[i]);
      printf("%d %d\n", X[t], *S[t].upper_bound(y[i]));
    }
  }
}
int main() {
  input();
  prep();
  output();
  return 0;
}
