#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 3e5 + 66;
const ll inf = 2e18;
struct node {
  int L, R;
  ll x, y;
  node(int a, int b, ll c, ll d) { L = a, R = b, x = c, y = d; }
};
vector<node> lines;
ll a[N], b[N], ans[N], q[N];
int t[N], rem[N], ind[N];
struct line {
  ll k, b;
  ll f(ll x) { return k * x + b; }
  line(ll a, ll c) { k = a, b = c; }
};
using ld = long double;
ld inter(line a, line b) { return (ld)(b.b - a.b) / (ld)(a.k - b.k); }
struct CHT {
  vector<line> v;
  CHT() { v.assign(N, {0, 0}); }
  int sz = 0, l = 0;
  void clear() { sz = l = 0; }
  void add(line a) {
    if (sz > 0 && v[sz - 1].k == a.k) {
      if (v[sz - 1].b < a.b)
        sz--;
      else
        return;
    }
    while (sz >= 2 && inter(v[sz - 1], v[sz - 2]) > inter(v[sz - 2], a)) sz--;
    v[sz++] = a;
  }
  ll get(ll x) {
    if (sz == l) return -inf;
    while (sz > l + 1 && inter(v[l], v[1 + l]) < ld(x)) ++l;
    return v[l].f(x);
  }
};
const int K = 5000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    if (t[i] == 1) cin >> a[i] >> b[i];
    if (t[i] == 2) {
      cin >> ind[i];
      ind[i]--;
      rem[ind[i]] = i;
      int L = ind[i], R = i;
      ll x = a[ind[i]], y = b[ind[i]];
      lines.emplace_back(L, R, x, y);
    }
    if (t[i] == 3) cin >> q[i], ans[i] = -inf;
  }
  for (int i = 0; i < n; ++i) {
    if (t[i] == 1 && rem[i] == 0) {
      rem[i] = n;
      lines.emplace_back(i, n, a[i], b[i]);
    }
  }
  CHT cht;
  sort(lines.begin(), lines.end(),
       [](node a, node b) { return a.x != b.x ? a.x < b.x : a.y < b.y; });
  vector<int> ask;
  vector<int> ins;
  for (int L = 0; L < n; L += K) {
    int R = L + K;
    R = min(R, n);
    cht.clear();
    for (auto line : lines) {
      if (line.L < L && line.R >= R) {
        cht.add({line.x, line.y});
      }
    }
    ask.clear();
    ins.clear();
    for (int i = L; i < R; ++i) {
      if (t[i] == 1) {
        ins.emplace_back(i);
      } else if (t[i] == 3) {
        ask.emplace_back(i);
        for (int j : ins) {
          if (rem[j] > i) {
            ans[i] = max(ans[i], a[j] * q[i] + b[j]);
          }
        }
      }
    }
    ins.clear();
    for (int i = R - 1; i >= L; --i) {
      if (t[i] == 2) {
        ins.emplace_back(i);
      } else if (t[i] == 3) {
        for (int j : ins) {
          if (ind[j] < i) {
            ans[i] = max(ans[i], a[ind[j]] * q[i] + b[ind[j]]);
          }
        }
      }
    }
    sort(ask.begin(), ask.end(), [](int a, int b) { return q[a] < q[b]; });
    for (int i : ask) {
      ans[i] = max(ans[i], cht.get(q[i]));
    }
  }
  for (int i = 0; i < n; ++i) {
    if (t[i] == 3) {
      if (ans[i] == -inf)
        cout << "EMPTY SET\n";
      else
        cout << ans[i] << "\n";
    }
  }
}
