#include <bits/stdc++.h>
using namespace std;
const long long int is_query = LLONG_MIN;
struct Line {
  long long int m, b;
  mutable function<const Line*()> succ;
  bool operator<(const Line& rhs) const {
    if (rhs.b != is_query) return m < rhs.m;
    const Line* s = succ();
    if (!s) return 0;
    long long int x = rhs.m;
    return b - s->b < (s->m - m) * x;
  }
};
struct HullDynamic : public multiset<Line> {
  bool bad(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) return 0;
      return y->m == z->m && y->b <= z->b;
    }
    auto x = prev(y);
    if (z == end()) return y->m == x->m && y->b <= x->b;
    return 1.0 * (x->b - y->b) * (z->m - y->m) >
           1.0 * (y->b - z->b) * (y->m - x->m);
  }
  void Add(long long int m, long long int b) {
    auto y = insert({m, b});
    y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
    if (bad(y)) {
      erase(y);
      return;
    }
    while (next(y) != end() && bad(next(y))) erase(next(y));
    while (y != begin() && bad(prev(y))) erase(prev(y));
  }
  long long int Query(long long int x) {
    auto l = lower_bound((Line){x, is_query});
    if (l == end()) return LLONG_MIN;
    return l->m * x + l->b;
  }
};
HullDynamic Tree[4 * 300005];
long long int query(int node, int lo, int hi, int i, int j, long long int x) {
  if (i > hi || j < lo) return LLONG_MIN;
  long long int ret = LLONG_MIN;
  ret = Tree[node].Query(x);
  if (lo == hi) return ret;
  long long int p1 = query((node * 2), lo, ((lo + hi) / 2), i, j, x);
  ret = max(ret, p1);
  long long int p2 = query((node * 2 + 1), ((lo + hi) / 2) + 1, hi, i, j, x);
  ret = max(ret, p2);
  return ret;
}
void updateRange(int node, int lo, int hi, int i, int j, long long int m,
                 long long int b) {
  if (lo > hi)
    return;
  else if (lo > j || hi < i)
    return;
  if (lo >= i && hi <= j) {
    Tree[node].Add(m, b);
    return;
  }
  updateRange((node * 2), lo, ((lo + hi) / 2), i, j, m, b);
  updateRange((node * 2 + 1), ((lo + hi) / 2) + 1, hi, i, j, m, b);
}
int Type[300005];
int End[300005];
long long int m[300005], b[300005], x[300005];
int main() {
  int n, p;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &Type[i]);
    if (Type[i] == 1) {
      scanf("%lld %lld", &m[i], &b[i]);
      End[i] = n;
    } else if (Type[i] == 2) {
      scanf("%d", &p);
      End[p] = i;
    } else
      scanf("%lld", &x[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (Type[i] == 1) updateRange(1, 1, n, i, End[i], m[i], b[i]);
    if (Type[i] == 3) {
      long long int ret = query(1, 1, n, i, i, x[i]);
      if (ret == LLONG_MIN)
        printf("EMPTY SET\n");
      else
        printf("%lld\n", ret);
    }
  }
}
