#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  char c;
  int flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag *= -1;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
  return;
}
inline void read(long long &x) {
  char c;
  int flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag *= -1;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
  return;
}
inline void read(char &x) {
  char c = getchar();
  while (!isalpha(c)) c = getchar();
  x = c;
}
struct query {
  char tmp;
  long long x, y;
} q[400005];
set<long long> s[400005];
long long st[800005];
vector<long long> dis;
long long a, b;
bool f;
long long retx, rety;
void rem(int l, int r, int pt, int idx) {
  if (l == r) {
    s[a].erase(b);
    st[idx] = (s[a].empty() ? -1 : *(--s[a].end()));
    return;
  }
  int mid = (l + r) >> 1;
  if (pt > mid)
    rem(mid + 1, r, pt, idx * 2 + 1);
  else
    rem(l, mid, pt, idx * 2);
  st[idx] = max(st[idx << 1], st[idx * 2 + 1]);
  return;
}
void update(int l, int r, int pt, int idx) {
  if (l == r) {
    s[a].insert(b);
    st[idx] = *(--s[a].end());
    return;
  }
  int mid = (l + r) >> 1;
  if (pt > mid)
    update(mid + 1, r, pt, idx * 2 + 1);
  else
    update(l, mid, pt, idx * 2);
  st[idx] = max(st[idx << 1], st[idx * 2 + 1]);
  return;
}
void ask(int l, int r, int pt, int idx) {
  if (r <= pt) return;
  if (st[idx] == -1 || st[idx] <= b) {
    if (f) return;
    retx = -1;
    return;
  }
  if (l == r) {
    if (f) return;
    f = true;
    retx = l;
    rety = *s[l].upper_bound(b);
    return;
  }
  int mid = (l + r) >> 1;
  ask(l, mid, pt, idx * 2);
  if (!f) ask(mid + 1, r, pt, idx * 2 + 1);
  return;
}
int main() {
  memset(st, -1, sizeof(st));
  long long n;
  read(n);
  for (int i = 0; i < n; ++i) {
    char t;
    long long A, B;
    read(t);
    read(A);
    read(B);
    dis.push_back(A);
    q[i] = (query){t, A, B};
  }
  sort(dis.begin(), dis.end());
  dis.resize(unique(dis.begin(), dis.end()) - dis.begin());
  for (int i = 0; i < n; ++i)
    q[i].x = lower_bound(dis.begin(), dis.end(), q[i].x) - dis.begin();
  int siz = dis.size();
  for (int i = 0; i < n; ++i) {
    char tmp = q[i].tmp;
    a = q[i].x, b = q[i].y;
    if (tmp == 'a') {
      update(0, siz - 1, a, 1);
    } else if (tmp == 'r') {
      rem(0, siz - 1, a, 1);
    } else {
      f = false;
      retx = rety = -1;
      ask(0, siz - 1, a, 1);
      if (retx != -1)
        printf("%lld %lld\n", dis[retx], rety);
      else
        printf("-1\n");
    }
  }
}
