#include <bits/stdc++.h>
using namespace std;
struct CHT {
 public:
  vector<pair<int, int> > lines;

 public:
  CHT() {}
  void addLine(pair<int, int> line) { lines.push_back(line); }
  void build() {
    sort(lines.begin(), lines.end());
    vector<pair<int, int> > _lines = lines;
    lines.clear();
    for (pair<int, int> line : _lines) insert(line);
  }
  long long query(int first) {
    if (lines.empty()) return LLONG_MIN;
    int L = 0, R = lines.size() - 1;
    while (L != R) {
      int mid1 = L + (R - L) / 3;
      int mid2 = R - (R - L) / 3;
      if (lines[mid1].first * 1LL * first + lines[mid1].second >=
          lines[mid2].first * 1LL * first + lines[mid2].second)
        R = mid2 - 1;
      else
        L = mid1 + 1;
    }
    return lines[L].first * 1LL * first + lines[L].second;
  }

 private:
  bool bad(pair<int, int> line1, pair<int, int> line2, pair<int, int> line3) {
    return (line3.second - line1.second) * 1LL * (line1.first - line2.first) <=
           (line2.second - line1.second) * 1LL * (line1.first - line3.first);
  }
  void insert(pair<int, int> line) {
    while (lines.size() > 0 && lines.back().first == line.first)
      lines.pop_back();
    lines.push_back(line);
    int sz = lines.size();
    while (sz >= 3 && bad(lines[sz - 3], lines[sz - 2], lines[sz - 1])) {
      lines.erase(lines.end() - 2);
      sz--;
    }
  }
};
const int N = int(3e5) + 10;
int n;
map<int, pair<int, int> > line_at_query;
vector<pair<int, int> > queries;
CHT st[4 * N];
void build(int stI, int L, int R) {
  st[stI].build();
  if (L == R) return;
  int mid = (L + R) / 2;
  build((stI << 1), L, mid);
  build((stI << 1) + 1, mid + 1, R);
}
void build() { build(1, 1, n); }
void insert(int stI, int L, int R, int l, int r, pair<int, int> val) {
  if (r < L || R < l) return;
  if (l <= L && R <= r) {
    st[stI].addLine(val);
    return;
  }
  int mid = (L + R) / 2;
  insert((stI << 1), L, mid, l, r, val);
  insert((stI << 1) + 1, mid + 1, R, l, r, val);
}
void insert(int l, int r, pair<int, int> val) { insert(1, 1, n, l, r, val); }
long long query(int stI, int L, int R, int at, int first) {
  if (at < L || R < at) return LLONG_MIN;
  if (L == R) return st[stI].query(first);
  long long ret = st[stI].query(first);
  int mid = (L + R) / 2;
  ret = max(ret, query((stI << 1), L, mid, at, first));
  ret = max(ret, query((stI << 1) + 1, mid + 1, R, at, first));
  return ret;
}
long long query(int at, int first) { return query(1, 1, n, at, first); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int a, b;
      scanf("%d %d", &a, &b);
      line_at_query[i] = make_pair(a, b);
    } else if (t == 2) {
      int _i;
      scanf("%d", &_i);
      insert(_i, i, line_at_query[_i]);
      line_at_query.erase(_i);
    } else if (t == 3) {
      int q;
      scanf("%d", &q);
      queries.push_back(make_pair(i, q));
    }
  }
  for (auto item : line_at_query) {
    insert(item.first, n, item.second);
  }
  build();
  for (pair<int, int> p : queries) {
    long long ans = query(p.first, p.second);
    if (ans == LLONG_MIN)
      puts("EMPTY SET");
    else
      printf("%lld\n", ans);
  }
  return 0;
}
