#include <bits/stdc++.h>
using namespace std;
multiset<int> freq[200002];
vector<pair<string, pair<int, int> > > df;
vector<pair<int, int> > vx, vy;
int inf = 1e9, tree[4 * 200002 + 1], alocx[4 * 200002 + 1],
    alocy[4 * 200002 + 1];
void add(int node, int i, int j, int pos, int val) {
  if (i == pos && j == pos) {
    tree[node] = max(tree[node], val);
    return;
  }
  int mid = (i + j) / 2;
  if (pos <= mid)
    add(2 * node, i, mid, pos, val);
  else if (pos > mid)
    add(2 * node + 1, mid + 1, j, pos, val);
  tree[node] = max(tree[2 * node], tree[2 * node + 1]);
}
void subt(int node, int i, int j, int pos) {
  if (i == pos && j == pos) {
    if (freq[pos].size() != 0)
      tree[node] = *(freq[pos].rbegin());
    else
      tree[node] = -inf;
    return;
  }
  int mid = (i + j) / 2;
  if (pos <= mid)
    subt(2 * node, i, mid, pos);
  else if (pos > mid)
    subt(2 * node + 1, mid + 1, j, pos);
  tree[node] = max(tree[2 * node + 1], tree[2 * node]);
}
int query(int node, int i, int j, int xx, int yy) {
  if (tree[node] <= yy || j <= xx) return -1;
  if (i == j) return i;
  int mid = (i + j) / 2;
  int temp = query(2 * node, i, mid, xx, yy);
  if (temp == -1) temp = query(2 * node + 1, mid + 1, j, xx, yy);
  return temp;
}
int main() {
  int n, i, x, y, k = 1, xx, yy;
  string str;
  char s[10];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %d %d", s, &x, &y);
    vx.push_back(make_pair(x, i));
    vy.push_back(make_pair(y, i));
    df.push_back(make_pair(s, make_pair(x, y)));
  }
  sort(vx.begin(), vx.end());
  sort(vy.begin(), vy.end());
  int j;
  for (i = 0; i < n; i++) {
    j = vx[i].second;
    alocx[k] = df[j].second.first;
    df[j].second.first = k;
    if (i != n - 1)
      if (vx[i + 1].first != vx[i].first) k++;
  }
  k = 1;
  for (i = 0; i < n; i++) {
    j = vy[i].second;
    alocy[k] = df[j].second.second;
    df[j].second.second = k;
    if (i != n - 1)
      if (vy[i + 1].first != vy[i].first) k++;
  }
  for (i = 1; i <= 4 * n + 1; i++) tree[i] = -inf;
  for (i = 0; i < n; i++) {
    str = df[i].first;
    x = df[i].second.first;
    y = df[i].second.second;
    if (str[0] == 'a') {
      freq[x].insert(y);
      add(1, 1, n, x, y);
    } else if (str[0] == 'r') {
      freq[x].erase(freq[x].find(y));
      subt(1, 1, n, x);
    } else if (str[0] == 'f') {
      int ff = query(1, 1, n, x, y), gg;
      if (ff == inf)
        printf("-1");
      else {
        if (freq[ff].upper_bound(y) == freq[ff].end())
          printf("-1");
        else {
          gg = *(freq[ff].upper_bound(y));
          printf("%d %d", alocx[ff], alocy[gg]);
        }
      }
      printf("\n");
    }
  }
  return 0;
}
