#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 10, INF = 1e9;
map<int, int> mp, anti;
int seg[4 * N];
set<int> po[N];
int x[N], y[N], ID, St = INF, En = INF;
char t[N][10];
void reset() {
  ID = St = En = INF;
  return;
}
void change(int id, int p, int s, int e) {
  if (e - s < 2) {
    if (po[s].size() == 0)
      seg[id] = -1;
    else {
      auto it = po[s].end();
      it--;
      seg[id] = *it;
    }
    return;
  }
  int mid = (s + e) / 2;
  if (p < mid)
    change(2 * id, p, s, mid);
  else
    change(2 * id + 1, p, mid, e);
  seg[id] = max(seg[2 * id], seg[2 * id + 1]);
  return;
}
bool is_it(int id, int val, int L, int R, int s, int e) {
  if (L <= s && e <= R) {
    if (seg[id] > val) {
      if (St > s) {
        St = s;
        En = e;
        ID = id;
      }
      return true;
    } else
      return false;
  }
  if (s >= R || L >= e) return false;
  int mid = (s + e) / 2;
  return is_it(2 * id, val, L, R, s, mid) |
         is_it(2 * id + 1, val, L, R, mid, e);
}
int get_minx(int id, int s, int e, int val) {
  if (e - s < 2) {
    return s;
  }
  int mid = (s + e) / 2;
  if (seg[2 * id] > val)
    return get_minx(2 * id, s, mid, val);
  else
    return get_minx(2 * id + 1, mid, e, val);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> t[i];
    cin >> x[i] >> y[i];
    mp[x[i]] = 1;
  }
  set<int> tmp;
  int n = 0;
  for (auto X : mp) {
    anti[n] = X.first;
    mp[X.first] = n++;
    tmp.insert(X.first);
  }
  for (int i = 0; i < q; i++) {
    if (t[i][0] == 'a') {
      po[mp[x[i]]].insert(y[i]);
      change(1, mp[x[i]], 0, n);
    } else if (t[i][0] == 'r') {
      po[mp[x[i]]].erase(y[i]);
      change(1, mp[x[i]], 0, n);
    } else {
      ID = INF;
      St = INF;
      En = INF;
      if (is_it(1, y[i], mp[x[i]] + 1, n, 0, n) == false) {
        cout << -1 << '\n';
        continue;
      }
      int ansx = get_minx(ID, St, En, y[i]);
      cout << anti[ansx] << " " << *(po[ansx].upper_bound(y[i])) << '\n';
    }
  }
}
