#include <bits/stdc++.h>
using namespace std;
struct Node {
  Node *left, *right;
  int l, r;
  vector<int> *vylist;
  int maxy;
};
const int MAXN = 200000;
int request[MAXN][3];
int discrete[MAXN];
int dislen;
Node *root;
int ansx, ansy;
bool ansfound;
Node *MakeSegmentTree(int l, int r) {
  Node *ret = new Node;
  ret->l = l;
  ret->r = r;
  ret->maxy = -1;
  if (l == r) {
    ret->left = NULL;
    ret->right = NULL;
    ret->vylist = new vector<int>();
  } else {
    int mid = (l + r) / 2;
    ret->left = MakeSegmentTree(l, mid);
    ret->right = MakeSegmentTree(mid + 1, r);
    ret->vylist = NULL;
  }
  return ret;
}
void AddPointSegmentTree(Node *p, int reqx, int reqy) {
  if (p->l == p->r) {
    p->vylist->insert(upper_bound(p->vylist->begin(), p->vylist->end(), reqy),
                      reqy);
    p->maxy = p->vylist->back();
  } else {
    int mid = (p->l + p->r) / 2;
    if (discrete[mid] >= reqx)
      AddPointSegmentTree(p->left, reqx, reqy);
    else
      AddPointSegmentTree(p->right, reqx, reqy);
    p->maxy = max(p->left->maxy, p->right->maxy);
  }
  return;
}
void RemovePointSegmentTree(Node *p, int reqx, int reqy) {
  if (p->l == p->r) {
    p->vylist->erase(lower_bound(p->vylist->begin(), p->vylist->end(), reqy));
    if (p->vylist->size() == 0)
      p->maxy = -1;
    else
      p->maxy = p->vylist->back();
  } else {
    int mid = (p->l + p->r) / 2;
    if (discrete[mid] >= reqx)
      RemovePointSegmentTree(p->left, reqx, reqy);
    else
      RemovePointSegmentTree(p->right, reqx, reqy);
    p->maxy = max(p->left->maxy, p->right->maxy);
  }
  return;
}
void FindPointSegmentTree(Node *p, int reqx, int reqy) {
  if (p->maxy <= reqy) return;
  if (p->l == p->r) {
    vector<int>::iterator iter =
        upper_bound(p->vylist->begin(), p->vylist->end(), reqy);
    ansx = discrete[p->l];
    ansy = *iter;
    ansfound = true;
    return;
  } else {
    int mid = (p->l + p->r) / 2;
    if (discrete[mid] > reqx) {
      FindPointSegmentTree(p->left, reqx, reqy);
      if (ansfound) return;
      FindPointSegmentTree(p->right, reqx, reqy);
    } else if (discrete[p->r] > reqx) {
      FindPointSegmentTree(p->right, reqx, reqy);
    }
  }
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    char st[10];
    scanf("%s %d %d", st, &(request[i][1]), &(request[i][2]));
    if (strcmp(st, "add") == 0)
      request[i][0] = 0;
    else if (strcmp(st, "remove") == 0)
      request[i][0] = 1;
    else if (strcmp(st, "find") == 0)
      request[i][0] = 2;
    discrete[i] = request[i][1];
  }
  sort(discrete, discrete + n);
  dislen = unique(discrete, discrete + n) - discrete;
  root = MakeSegmentTree(0, dislen - 1);
  for (int i = 0; i < n; i++)
    if (request[i][0] == 0)
      AddPointSegmentTree(root, request[i][1], request[i][2]);
    else if (request[i][0] == 1)
      RemovePointSegmentTree(root, request[i][1], request[i][2]);
    else if (request[i][0] == 2) {
      ansfound = false;
      FindPointSegmentTree(root, request[i][1], request[i][2]);
      if (!ansfound)
        printf("-1\n");
      else
        printf("%d %d\n", ansx, ansy);
    }
  return 0;
}
