#include <bits/stdc++.h>
using namespace std;
const int T = 1 << 18;
int type[T], x[T], y[T], n, maxx[T << 1], maxy[T << 1];
map<pair<int, int>, int> m;
void modify(int x, int y, bool add) {
  int id = T + m[{x, y}];
  if (add)
    maxx[id] = x, maxy[id] = y;
  else
    maxx[id] = maxy[id] = 0;
  for (int i = id >> 1; i; i >>= 1) {
    maxx[i] = max(maxx[i << 1], maxx[(i << 1) | 1]);
    maxy[i] = max(maxy[i << 1], maxy[(i << 1) | 1]);
  }
}
int query(int id, int x, int y) {
  if (maxx[id] < x || maxy[id] < y) return -1;
  if (id >= T) return id;
  int buf = query(id << 1, x, y);
  if (buf != -1) return buf;
  return query((id << 1) | 1, x, y);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    char buf[100];
    cin >> buf >> x[i] >> y[i];
    if (buf[0] == 'a')
      type[i] = 0;
    else if (buf[0] == 'r')
      type[i] = 1;
    else
      type[i] = 2;
    if (type[i] != 2) m[{x[i], y[i]}] = 0;
  }
  int id = 0;
  for (auto &j : m) j.second = id++;
  for (int i = 0; i < n; i++)
    if (!type[i])
      modify(x[i], y[i], 1);
    else if (type[i] == 1)
      modify(x[i], y[i], 0);
    else {
      int ans = query(1, x[i] + 1, y[i] + 1);
      if (ans == -1)
        cout << "-1\n";
      else
        cout << maxx[ans] << ' ' << maxy[ans] << endl;
    }
  return 0;
}
