#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 111 * 1000;
set<pair<int, int>> seg[N];
int a[2 * N];
int b[2 * N];
int n;
vector<string> s;
vector<int> vec;
void compress(int *a, int n, int *b) {
  for (int i = 0; i < n; i++) {
    vec.push_back(a[i * 2]);
  }
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  for (int i = 0; i < n; i++) {
    b[i * 2] = lower_bound(vec.begin(), vec.end(), a[i * 2]) - vec.begin();
  }
}
void add(int p, pair<int, int> val) {
  p = N - p - 100;
  for (p++; p < N; p += p & -p) {
    seg[p].insert(val);
  }
}
void del(int p, pair<int, int> val) {
  p = N - p - 100;
  for (p++; p < N; p += p & -p) {
    seg[p].erase(val);
  }
}
auto it = seg[0].lower_bound({-1, -1});
pair<int, int> get(int x, int y) {
  int p = N - x - 100;
  pair<int, int> ans = {1 << 30, 1 << 30};
  for (; p; p -= p & -p) {
    it = seg[p].lower_bound({y + 1, -1});
    if (it != seg[p].end()) {
      ans = min(ans, *it);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < N; i++) {
    seg[i].insert({1 << 30, 1 << 30});
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    string sign;
    cin >> sign >> b[i * 2 + 1] >> a[i * 2];
    s.push_back(sign);
  }
  compress(a, n, b);
  for (int i = 0; i < n; i++) {
    if (s[i] == "add") {
      add(b[2 * i], {b[2 * i + 1], b[2 * i]});
    }
    if (s[i] == "remove") {
      del(b[2 * i], {b[2 * i + 1], b[2 * i]});
    }
    if (s[i] == "find") {
      pair<int, int> p = get(b[i * 2], b[i * 2 + 1]);
      if (p.first == 1 << 30) {
        cout << -1 << "\n";
      } else {
        cout << p.first << " " << vec[p.second] << "\n";
      }
    }
  }
}
