#include <bits/stdc++.h>
int sgn(int a) {
  if (!a) return 0;
  if (a > 0) return 1;
  return -1;
}
int di(int a, int b) {
  if (!a) return 0;
  if (sgn(a) == sgn(b)) return a / b;
  return a / b - 1;
}
struct query {
  int t, a, b;
};
const int N = 300000;
const int K = 20000;
int n;
long long ans[N];
query q[N];
bool rm[N];
int main() {
  scanf("%d", &n);
  memset(ans, 0xc0, 8 * n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &q[i].t);
    if (q[i].t == 1)
      scanf("%d%d", &q[i].a, &q[i].b);
    else
      scanf("%d", &q[i].a);
    if (q[i].t == 2) --q[i].a;
  }
  std::deque<std::pair<int, int> > d;
  std::vector<std::pair<int, int> > pt;
  std::vector<int> cur;
  std::set<std::pair<int, int> > l;
  for (int i = 0; i < n; i += K) {
    if (i)
      for (int j = i - K; j < i; ++j)
        if (q[j].t == 1 && !rm[j]) l.insert(std::make_pair(q[j].a, q[j].b));
    for (int j = i; j < std::min(i + K, n); ++j) {
      if (q[j].t == 3)
        pt.push_back(std::make_pair(q[j].a, j));
      else if (q[j].t == 2 && q[j].a < i) {
        cur.push_back(q[j].a);
        l.erase(std::make_pair(q[q[j].a].a, q[q[j].a].b));
      }
    }
    std::sort(pt.begin(), pt.end());
    for (std::set<std::pair<int, int> >::iterator it = l.begin(); it != l.end();
         ++it)
      if (d.empty() || d.back().first != it->first ||
          it->second > d.back().second && (d.pop_back(), true)) {
        while (d.size() > 1 &&
               di(d.back().second - it->second, it->first - d.back().first) <=
                   di(d.back().second - d[(int)d.size() - 2].second,
                      d[(int)d.size() - 2].first - d.back().first))
          d.pop_back();
        d.push_back(*it);
      }
    if (!l.empty())
      for (int i = 0; i < (int)pt.size(); ++i) {
        while (d.size() > 1 &&
               (long long)d[0].first * pt[i].first + d[0].second <=
                   (long long)d[1].first * pt[i].first + d[1].second)
          d.pop_front();
        ans[pt[i].second] = (long long)d[0].first * pt[i].first + d[0].second;
      }
    for (int j = i; j < std::min(i + K, n); ++j) {
      if (q[j].t == 3) {
        bool any = !l.empty();
        for (int k = 0; k < (int)cur.size(); ++k)
          if (!rm[cur[k]]) {
            any = true;
            ans[j] =
                std::max(ans[j], (long long)q[j].a * q[cur[k]].a + q[cur[k]].b);
          }
        if (any)
          printf("%lld\n", ans[j]);
        else
          printf("EMPTY SET\n");
      } else if (q[j].t == 2)
        rm[q[j].a] = true;
      else
        cur.push_back(j);
    }
    d.clear();
    pt.clear();
    cur.clear();
  }
  return 0;
}
