#include <bits/stdc++.h>
using namespace std;
int q, OP[300010][2];
struct Line {
  int k, b;
  double xLeft;
  bool type;
  Line(int _k = 0, int _b = 0) {
    k = _k;
    b = _b;
    xLeft = -9e18;
    type = false;
  }
  bool operator<(const Line &l) const {
    if (l.type) return xLeft < l.xLeft;
    return k < l.k || k == l.k && b < l.b;
  }
} lines[300010];
int fin[300010];
set<Line> env[1200010];
int tl, tr;
Line tv;
double intersect(Line a, Line b) { return 1.0 * (b.b - a.b) / (a.k - b.k); }
bool check(Line a, Line b, Line c) {
  if (a.k == b.k) return true;
  return intersect(a, b) <= intersect(a, c);
}
void addLine(int id) {
  set<Line> &now = env[id];
  Line l;
  auto it = now.insert(tv).first;
  if (it != now.begin() && next(it) != now.end() &&
      check(*next(it), *it, *prev(it))) {
    now.erase(it);
    return;
  }
  while (it != now.begin() && prev(it) != now.begin() &&
         check(*it, *prev(it), *prev(prev(it))))
    now.erase(prev(it));
  if (it != now.begin()) {
    l = *it;
    l.xLeft = intersect(*it, *prev(it));
    now.erase(it);
    it = now.insert(l).first;
  }
  while (next(it) != now.end() && next(next(it)) != now.end() &&
         check(*next(next(it)), *next(it), *it))
    now.erase(next(it));
  if (next(it) != now.end()) {
    l = *next(it);
    l.xLeft = intersect(*it, *next(it));
    now.erase(next(it));
    now.insert(l);
  }
}
long long calcLine(int id) {
  Line goal;
  goal.type = true;
  goal.xLeft = OP[tl][1];
  if (env[id].empty()) return -9e18;
  auto it = prev(env[id].lower_bound(goal));
  return 1LL * (it->k) * OP[tl][1] + (it->b);
}
void add(int id, int l, int r) {
  int nxt = id << 1, mid = (l + r) >> 1;
  if (tl <= l && r <= tr)
    addLine(id);
  else {
    if (tl <= mid) add(nxt, l, mid);
    if (tr > mid) add(nxt | 1, mid + 1, r);
  }
}
long long query(int id, int l, int r) {
  int nxt = id << 1, mid = (l + r) >> 1;
  if (l == r) return calcLine(id);
  return max(calcLine(id),
             tl <= mid ? query(nxt, l, mid) : query(nxt | 1, mid + 1, r));
}
int main() {
  int i;
  long long val;
  scanf("%d", &q);
  for (i = 1; i <= q; i++) fin[i] = q;
  for (i = 1; i <= q; i++) {
    scanf("%d", &OP[i][0]);
    if (OP[i][0] == 1)
      scanf("%d%d", &lines[i].k, &lines[i].b);
    else {
      scanf("%d", &OP[i][1]);
      if (OP[i][0] == 2) fin[OP[i][1]] = i;
    }
  }
  for (i = 1; i <= q; i++) {
    if (OP[i][0] == 1) {
      tl = i;
      tr = fin[i];
      tv = lines[i];
      add(1, 1, q);
    } else if (OP[i][0] == 3) {
      tl = tr = i;
      val = query(1, 1, q);
      if (val <= -9e18)
        printf("EMPTY SET\n");
      else
        printf("%I64d\n", val);
    }
  }
  return 0;
}
