#include <bits/stdc++.h>
using namespace std;
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int dx8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
bool AreEqual(double a, double b) { return (fabs(a - b) < 1e-10); }
template <class T>
bool GetNr(T &_value) {
  T _sign = 1;
  char ch;
  _value = 0;
  while (!isdigit(ch = getchar())) {
    if (ch == -1) return false;
    ch == '-' ? _sign = -1 : _sign = 1;
  }
  do {
    _value = _value * 10 + (ch - '0');
  } while (isdigit(ch = getchar()));
  _value *= _sign;
  return true;
}
int N, nr_nodes;
vector<tuple<int, int, int> > operations;
vector<int> positions, new_pos, segment_x(2 * 262144 + 1),
    segment_y(2 * 262144 + 1);
bool ByPoint(int a, int b) {
  int x1, x2, y1, y2;
  tie(ignore, x1, y1) = operations[a];
  tie(ignore, x2, y2) = operations[b];
  return make_pair(x1, y1) < make_pair(x2, y2);
}
void Update(int node, int x, int y) {
  node += nr_nodes;
  segment_x[node] = x;
  segment_y[node] = y;
  for (node >>= 1; node; node >>= 1) {
    segment_x[node] = max(segment_x[node << 1], segment_x[node << 1 | 1]);
    segment_y[node] = max(segment_y[node << 1], segment_y[node << 1 | 1]);
  }
}
int Query(int node, int x, int y) {
  if (segment_x[node] < x || segment_y[node] < y) {
    return -1;
  }
  if (node >= nr_nodes) {
    return node;
  }
  int ans = Query(node << 1, x, y);
  if (ans == -1) ans = Query(node << 1 | 1, x, y);
  return ans;
}
int main() {
  int i, x, y;
  char word[10];
  GetNr(N);
  operations.resize(N);
  positions.resize(N);
  new_pos.resize(N);
  for (i = 0; i < N; ++i) {
    int op;
    scanf("%s", word);
    GetNr(x);
    GetNr(y);
    if (word[0] == 'a') {
      op = 0;
    }
    if (word[0] == 'r') {
      op = 1;
    }
    if (word[0] == 'f') {
      op = 2;
    }
    operations[i] = make_tuple(op, x, y);
    positions[i] = i;
  }
  sort((positions).begin(), (positions).end(), ByPoint);
  nr_nodes = 1;
  for (i = 1; i < N; ++i) {
    int x1, x2, y1, y2;
    tie(ignore, x1, y1) = operations[positions[i - 1]];
    tie(ignore, x2, y2) = operations[positions[i]];
    if (x2 != x1 || y2 != y1) {
      ++nr_nodes;
    }
    new_pos[positions[i]] = nr_nodes - 1;
  }
  nr_nodes = 262144;
  for (i = 0; i < N; ++i) {
    int op, x, y;
    tie(op, x, y) = operations[i];
    if (op == 0) {
      Update(new_pos[i], x, y);
    }
    if (op == 1) {
      Update(new_pos[i], 0, 0);
    }
    if (op == 2) {
      int pos = Query(1, x + 1, y + 1);
      if (pos != -1) {
        printf("%d %d\n", segment_x[pos], segment_y[pos]);
      } else {
        printf("-1\n");
      }
    }
  }
  return 0;
}
