#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const long long MN = numeric_limits<long long>::min();
template <typename T>
struct convex_hull {
  vector<pair<T, T> > cvh;
  void pushBack(pair<T, T> a) {
    while (cvh.size() > 1) {
      pair<T, T> &b = cvh[cvh.size() - 1];
      pair<T, T> &c = cvh[cvh.size() - 2];
      if ((c.second - a.second) * (b.first - c.first) <=
          (c.second - b.second) * (a.first - c.first))
        cvh.pop_back();
      else
        break;
    }
    cvh.push_back(a);
  }
  T getY(T x, T k, T b) { return k * x + b; }
  T getY(T x) {
    T mx = numeric_limits<T>::min();
    int l = 0, r = cvh.size() - 1;
    while (l <= r) {
      int m1 = l + (r - l) / 3;
      int m2 = r - (r - l) / 3;
      T r1 = getY(x, cvh[m1].first, cvh[m1].second);
      T r2 = getY(x, cvh[m2].first, cvh[m2].second);
      mx = max(mx, max(r1, r2));
      if (r1 < r2)
        l = m1 + 1;
      else
        r = m2 - 1;
    }
    return mx;
  }
};
vector<vector<int> > v;
vector<convex_hull<long long> > c;
int f[N];
int k[N], b[N];
int n;
void add(int l, int r, int w) {
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) v[l++].push_back(w);
    if (r & 1) v[--r].push_back(w);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int m;
  cin >> m;
  n = m + 1;
  v.resize(n << 1);
  c.resize(n << 1);
  vector<pair<int, int> > qq;
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    int q;
    switch (t) {
      case 1:
        cin >> k[i] >> b[i];
        f[i] = 1;
        break;
      case 2:
        cin >> q;
        f[q] = 2;
        add(q, i, q);
        break;
      case 3:
        cin >> q;
        qq.push_back(make_pair(i, q));
        break;
    }
  }
  for (int i = 1; i <= m; i++)
    if (f[i] == 1) add(i, n, i);
  for (int i = 1; i < v.size(); i++) {
    if (v[i].empty()) continue;
    vector<pair<long long, long long> > e;
    for (auto j : v[i]) e.push_back(make_pair(k[j], b[j]));
    sort(e.begin(), e.end());
    for (auto &it : e) c[i].pushBack(it);
  }
  for (auto &it : qq) {
    long long ans = MN;
    int i = it.first + n;
    int x = it.second;
    while (i) {
      ans = max(ans, c[i].getY(x));
      i >>= 1;
    }
    if (ans == MN) {
      cout << "EMPTY SET" << endl;
      continue;
    }
    cout << ans << endl;
  }
  return 0;
}
