#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 19;
int n;
int C[N], x1[N], x2[N];
bool dead[N];
class line {
 public:
  int m, n;
  line() {}
  line(int m, int n) {
    this->m = m;
    this->n = n;
  }
  double intersect(line oth) { return (double)(n - oth.n) / (oth.m - m); }
  bool operator<(line oth) const {
    if (m != oth.m) return m < oth.m;
    return n < oth.n;
  }
};
bool kill(line a, line b) { return a.m == b.m and a.n > b.n; }
class convex {
 public:
  vector<line> ls, v;
  convex() {}
  void add(int m, int n) {
    while (v.size() >= 2) {
      line l1 = v[v.size() - 2];
      line l2 = v[v.size() - 1];
      line l3(m, n);
      if (kill(l3, l2) or l1.intersect(l3) <= l1.intersect(l2))
        v.pop_back();
      else
        break;
    }
    while (v.size() and kill({m, n}, v.back())) v.pop_back();
    v.push_back({m, n});
  }
  void init() {
    sort(ls.begin(), ls.end());
    for (auto l : ls) add(l.m, l.n);
  }
  void addLine(int m, int n) { ls.push_back({m, n}); }
  long long get(int x) {
    if (v.size() == 0) return -5e18;
    if (v.size() > 1 and v[v.size() - 2].intersect(v.back()) <= x)
      return (long long)v.back().m * x + v.back().n;
    int l = 0, r = (int)v.size() - 2;
    while (l < r) {
      int m = (l + r) >> 1;
      line l1 = v[m + 1];
      line l2 = v[m];
      if (l1.intersect(l2) >= x)
        r = m;
      else
        l = m + 1;
    }
    return (long long)v[l].m * x + v[l].n;
  }
} t[N << 1];
void up(int l, int r, int m, int n) {
  for (l += N, r += N; l <= r; l = (l + 1) >> 1, r = (r - 1) >> 1) {
    if (l & 1) t[l].addLine(m, n);
    if (~r & 1) t[r].addLine(m, n);
  }
}
long long get(int x, int v) {
  long long res = -5e18;
  x += N;
  while (x >= 1) {
    res = max(res, t[x].get(v));
    x >>= 1;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", C + i);
    if (C[i] == 1) {
      scanf("%d %d", x1 + i, x2 + i);
    } else if (C[i] == 2) {
      scanf("%d", x1 + i);
      dead[x1[i]] = 1;
      up(x1[i], i - 1, x1[x1[i]], x2[x1[i]]);
    } else {
      scanf("%d", x1 + i);
    }
  }
  for (int i = 1; i <= n; i++)
    if (C[i] == 1 and !dead[i]) up(i, n, x1[i], x2[i]);
  for (int i = 1; i < (N << 1); i++) t[i].init();
  for (int i = 1; i <= n; i++) {
    if (C[i] == 3) {
      long long res = get(i, x1[i]);
      if (res < -4e18)
        puts("EMPTY SET");
      else
        printf("%lld\n", res);
    }
  }
  return 0;
}
