#include <bits/stdc++.h>
using namespace std;
struct fastIO {
  inline fastIO operator>>(int& num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(long long& num) {
    num = 0;
    char c = getchar();
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    bool foo = 0;
    if (c == '-') {
      foo = 1;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      num = (num << 3) + (num << 1) + c - '0';
      c = getchar();
    }
    if (foo) num = -num;
    return *this;
  }
  inline fastIO operator>>(float& num) {
    scanf("%f", &num);
    return *this;
  }
  inline fastIO operator>>(double& num) {
    scanf("%lf", &num);
    return *this;
  }
  inline fastIO operator>>(long double& num) {
    scanf("%Lf", &num);
    return *this;
  }
  inline fastIO operator>>(char& num) {
    num = getchar();
    while (num == ' ' || num == '\n') num = getchar();
    return *this;
  }
  inline fastIO operator>>(char* num) {
    int cnt = 0;
    char c = getchar();
    while (c == ' ' || c == '\n') c = getchar();
    while (c != ' ' && c != '\n') {
      num[cnt++] = c;
      c = getchar();
    }
    num[cnt] = 0;
    return *this;
  }
  inline fastIO operator>>(string& num) {
    cin >> num;
    return *this;
  }
  inline void printInt(const int& num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printInt(num / 10);
    putchar((num % 10) + '0');
  }
  inline void printINT(const long long& num) {
    if (num < 10) {
      putchar(num + '0');
      return;
    }
    printINT(num / 10);
    putchar((num % 10) + '0');
  }
  inline fastIO operator<<(const int& num) {
    if (num < 0)
      putchar('-'), printInt(-num);
    else
      printInt(num);
    return *this;
  }
  inline fastIO operator<<(const long long& num) {
    if (num < 0)
      putchar('-'), printINT(-num);
    else
      printINT(num);
    return *this;
  }
  inline fastIO operator<<(const float& num) {
    printf("%.10f", num);
    return *this;
  }
  inline fastIO operator<<(const double& num) {
    printf("%.16lf", num);
    return *this;
  }
  inline fastIO operator<<(const long double& num) {
    printf("%.20Lf", num);
    return *this;
  }
  inline fastIO operator<<(const char& num) {
    putchar(num);
    return *this;
  }
  inline fastIO operator<<(const char* num) {
    for (int i = 0; num[i]; i++) putchar(num[i]);
    return *this;
  }
  inline fastIO operator<<(const string& num) {
    cout << num;
    return *this;
  }
} fio;
const int T = 524288;
int mxx[1600005], mxy[1600005];
int op[200005], x[200005], y[200005];
char tmp[15];
map<pair<int, int>, int> m;
void add(int x, int y) {
  int ID = T + m[make_pair(x, y)];
  mxx[ID] = x;
  mxy[ID] = y;
  for (int i = ID >> 1; i > 0; i >>= 1) {
    mxx[i] = max(mxx[i << 1], mxx[i << 1 | 1]);
    mxy[i] = max(mxy[i << 1], mxy[i << 1 | 1]);
  }
}
void rem(int x, int y) {
  int ID = T + m[make_pair(x, y)];
  mxx[ID] = 0;
  mxy[ID] = 0;
  for (int i = ID >> 1; i > 0; i >>= 1) {
    mxx[i] = max(mxx[i << 1], mxx[i << 1 | 1]);
    mxy[i] = max(mxy[i << 1], mxy[i << 1 | 1]);
  }
}
int fnd(int id, int x, int y) {
  if (mxx[id] < x || mxy[id] < y) {
    return -1;
  }
  if (id >= T) {
    return id;
  }
  int tmp = fnd(id << 1, x, y);
  if (tmp != -1) {
    return tmp;
  }
  return fnd(id << 1 | 1, x, y);
}
int q, Cntm;
int main() {
  fio >> q;
  for (int i = 1; i <= q; i++) {
    fio >> tmp >> x[i] >> y[i];
    if (tmp[0] == 'a') {
      op[i] = 0;
    } else if (tmp[0] == 'r') {
      op[i] = 1;
    } else {
      op[i] = 2;
    }
    if (op[i] != 2) {
      m[make_pair(x[i], y[i])];
    }
  }
  for (__typeof(m.begin()) it = m.begin(); it != m.end(); it++) {
    it->second = Cntm++;
  }
  for (int i = 1; i <= q; i++) {
    if (op[i] == 0) {
      add(x[i], y[i]);
    } else if (op[i] == 1) {
      rem(x[i], y[i]);
    } else {
      int ff = fnd(1, x[i] + 1, y[i] + 1);
      if (ff == -1) {
        fio << -1 << '\n';
      } else {
        fio << mxx[ff] << ' ' << mxy[ff] << '\n';
      }
    }
  }
  return 0;
}
