#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long l[300005], r[300005], q[300005], ques[300005], mini = -2e18;
pair<long long, long long> p[300005];
vector<long long> vp;
vector<long long> v[1 << 20];
vector<double> vd[1 << 20];
bool cmp(long long x, long long y) { return p[x].first < p[y].first; }
double solve(long long x, long long y) {
  return 1.0 * (p[x].second - p[y].second) / (p[y].first - p[x].first);
}
void update(long long x, long long it) {
  while (!v[x].empty() && p[v[x].back()].first == p[it].first &&
         p[v[x].back()].second <= p[it].second) {
    v[x].pop_back();
    if (!v[x].empty()) vd[x].pop_back();
  }
  while (v[x].size() > 1 &&
         solve(v[x][v[x].size() - 2], it) > solve(v[x][v[x].size() - 1], it)) {
    v[x].pop_back();
    vd[x].pop_back();
  }
  v[x].emplace_back(it);
  if (v[x].size() > 1) vd[x].emplace_back(solve(v[x][v[x].size() - 2], it));
}
void update(long long x, long long l, long long r, long long tl, long long tr,
            long long it) {
  if (tl > r || l > tr) return;
  if (tl <= l && tr >= r) {
    update(x, it);
    return;
  }
  long long mid = (l + r) >> 1;
  update(x << 1, l, mid, tl, tr, it);
  update((x << 1) | 1, mid + 1, r, tl, tr, it);
}
long long get(long long x, long long it, long long pos) {
  if (v[x].empty()) {
    return mini;
  } else if (vd[x].empty()) {
    pair<long long, long long> t = p[v[x].back()];
    return t.first * it + t.second;
  } else {
    long long iter =
        lower_bound(vd[x].begin(), vd[x].end(), 1.0 * it) - vd[x].begin();
    pair<long long, long long> t = p[v[x][iter]];
    return t.first * it + t.second;
  }
}
long long query(long long x, long long l, long long r, long long it,
                long long pos) {
  long long re = get(x, it, pos);
  if (l == r) return re;
  long long mid = (l + r) >> 1;
  if (mid >= pos) {
    re = max(re, query(x << 1, l, mid, it, pos));
  } else
    re = max(re, query((x << 1) | 1, mid + 1, r, it, pos));
  return re;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> q[i];
    if (q[i] == 1) {
      cin >> p[i].first >> p[i].second;
      vp.emplace_back(i);
      l[i] = i;
      r[i] = n;
    } else if (q[i] == 2) {
      long long x;
      cin >> x;
      r[x] = i;
    } else {
      cin >> ques[i];
    }
  }
  sort(vp.begin(), vp.end(), cmp);
  for (auto u : vp) {
    update(1, 1, n, l[u], r[u], u);
  }
  for (long long i = 1; i <= n; i++)
    if (q[i] == 3) {
      long long t = query(1, 1, n, ques[i], i);
      if (t == mini) {
        cout << "EMPTY SET\n";
      } else
        cout << t << '\n';
    }
  return 0;
}
