#include <bits/stdc++.h>
long long R = 7 + 1e9, NUMTESTCASE;
const int NN = 10 + 1e6;
const double pi = acos(-1.0);
int di[4] = {1, 0, -1, 0}, dj[4] = {0, 1, 0, -1},
    DI[8] = {1, 1, 0, -1, -1, -1, 0, 1}, DJ[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using namespace std;
int q, XHash[NN], n, Max[NN];
set<int> Xocc;
set<int> MaxData[NN];
struct Input {
  string Type;
  int X, Y;
} Query[NN];
char Buff[10];
string Read() {
  scanf("%s", Buff);
  return Buff;
}
void Add(int Pos, int Val, int Node = 1, int st = 1, int en = n) {
  if (st > Pos || en < Pos) return;
  if (st == en) {
    MaxData[Node].insert(Val);
    Max[Node] = max(Max[Node], Val);
    return;
  }
  Add(Pos, Val, 2 * Node, st, (st + en) / 2);
  Add(Pos, Val, 2 * Node + 1, (st + en) / 2 + 1, en);
  Max[Node] = max(Max[2 * Node], Max[2 * Node + 1]);
}
void Errase(int Pos, int Val, int Node = 1, int st = 1, int en = n) {
  if (st > Pos || en < Pos) return;
  if (st == en) {
    MaxData[Node].erase(MaxData[Node].find(Val));
    if (MaxData[Node].size() == 0) return void((Max[Node] = -1));
    Max[Node] = *MaxData[Node].rbegin();
    return;
  }
  Errase(Pos, Val, 2 * Node, st, (st + en) / 2);
  Errase(Pos, Val, 2 * Node + 1, (st + en) / 2 + 1, en);
  Max[Node] = max(Max[2 * Node], Max[2 * Node + 1]);
}
int y, Res;
void GetAns(int Pos, int Node = 1, int st = 1, int en = n) {
  if (Res + 1) return;
  if (en <= Pos) return;
  if (Max[Node] <= y) return;
  if (st == en) {
    Res = st;
    y = *MaxData[Node].upper_bound(y);
    return;
  }
  GetAns(Pos, 2 * Node, st, (st + en) / 2);
  GetAns(Pos, 2 * Node + 1, (st + en) / 2 + 1, en);
}
int Getx(int Val) {
  int st = 1, en = n;
  while (st <= en) {
    if (XHash[(st + en) / 2] > Val)
      en = (st + en) / 2 - 1;
    else if (XHash[(st + en) / 2] < Val)
      st = (st + en) / 2 + 1;
    else
      return (st + en) / 2;
  }
}
int main() {
  memset(Max, -1, sizeof(Max));
  cin >> q;
  for (int i = (1); i <= (q); ++i) {
    Query[i].Type = Read();
    scanf("%d%d", &Query[i].X, &Query[i].Y);
    Xocc.insert(Query[i].X);
  }
  while (Xocc.size()) {
    XHash[++n] = *Xocc.begin();
    Xocc.erase(Xocc.begin());
  }
  for (int i = (1); i <= (q); ++i) {
    if (Query[i].Type == "add") {
      Add(Getx(Query[i].X), Query[i].Y);
      continue;
    }
    if (Query[i].Type == "remove") {
      Errase(Getx(Query[i].X), Query[i].Y);
      continue;
    }
    Res = -1;
    y = Query[i].Y;
    GetAns(Getx(Query[i].X));
    if (Res == -1) {
      puts("-1");
      continue;
    }
    printf("%d %d\n", XHash[Res], y);
  }
  return 0;
}
