#include <bits/stdc++.h>
using namespace std;
struct segNode {
  int left, right, mr;
} nodes[200010 << 2];
int op[200010][3];
pair<int, int> arr[200010];
void segBuild(int cur, int l, int r) {
  nodes[cur].left = l;
  nodes[cur].right = r;
  nodes[cur].mr = 0;
  if (l == r) {
    return;
  } else {
    int mid = (l + r) >> 1;
    segBuild(cur << 1, l, mid);
    segBuild((cur << 1) | 1, mid + 1, r);
  }
}
void segUpdate(int cur, int pos, int v) {
  if (nodes[cur].left == pos && nodes[cur].right == pos) {
    nodes[cur].mr = v;
    return;
  } else {
    int mid = (nodes[cur].left + nodes[cur].right) >> 1;
    if (pos <= mid) {
      segUpdate(cur << 1, pos, v);
    } else {
      segUpdate((cur << 1) | 1, pos, v);
    }
    nodes[cur].mr = max(nodes[cur << 1].mr, nodes[(cur << 1) | 1].mr);
  }
}
int segFind(int cur, int l, int r, int y) {
  if (nodes[cur].mr <= y || l > r) {
    return -1;
  }
  if (nodes[cur].left == nodes[cur].right) {
    return nodes[cur].left;
  }
  int mid = (nodes[cur].left + nodes[cur].right) >> 1;
  if (l > mid) {
    return segFind((cur << 1) | 1, l, r, y);
  } else {
    int tmp = segFind(cur << 1, l, mid, y);
    if (tmp == -1) {
      return segFind((cur << 1) | 1, mid + 1, r, y);
    } else {
      return tmp;
    }
  }
}
int main() {
  int n = 0, cx = 0, cy = 0, rx = 0, ry = 0;
  scanf("%d", &n);
  char s[20];
  int j = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%s%d%d", &s, &op[i][1], &op[i][2]);
    if (!strcmp(s, "add")) {
      op[i][0] = 1;
      arr[j].first = op[i][1];
      arr[j].second = op[i][2];
      ++j;
    } else if (!strcmp(s, "find")) {
      op[i][0] = 0;
    } else {
      op[i][0] = -1;
    }
  }
  sort(arr, arr + j);
  int N = unique(arr, arr + j) - arr;
  if (N != 0) {
    segBuild(1, 0, N - 1);
  }
  for (int i = 0; i < n; ++i) {
    if (op[i][0] == 1) {
      int pos = lower_bound(arr, arr + N, make_pair(op[i][1], op[i][2])) - arr;
      segUpdate(1, pos, op[i][2]);
    } else if (op[i][0] == -1) {
      int pos = lower_bound(arr, arr + N, make_pair(op[i][1], op[i][2])) - arr;
      segUpdate(1, pos, 0);
    } else {
      int pos =
          lower_bound(arr, arr + N, make_pair(op[i][1] + 1, op[i][2] + 1)) -
          arr;
      if (pos == N) {
        printf("-1\n");
      } else {
        int res = segFind(1, pos, N - 1, op[i][2]);
        if (res == -1) {
          printf("-1\n");
        } else {
          printf("%d %d\n", arr[res].first, arr[res].second);
        }
      }
    }
  }
  return 0;
}
