Problem: Lena is a programmer. She got a task to solve at work.

There is an empty set of pairs of integers and n queries to process. Each query is one of three types:

  1. Add a pair (a, b) to the set. 
  2. Remove a pair added in the query number i. All queries are numbered with integers from 1 to n. 
  3. For a given integer q find the maximal value x·q + y over all pairs (x, y) from the set. 



Help Lena to process the queries.

Input

The first line of input contains integer n (1 ≤ n ≤ 3·105) — the number of queries.

Each of the next n lines starts with integer t (1 ≤ t ≤ 3) — the type of the query.

A pair of integers a and b ( - 109 ≤ a, b ≤ 109) follows in the query of the first type.

An integer i (1 ≤ i ≤ n) follows in the query of the second type. It is guaranteed that i is less than the number of the query, the query number i has the first type and the pair from the i-th query is not already removed.

An integer q ( - 109 ≤ q ≤ 109) follows in the query of the third type.

Output

For the queries of the third type print on a separate line the desired maximal value of x·q + y.

If there are no pairs in the set print "EMPTY SET".

Example

Input

7
3 1
1 2 3
3 1
1 -1 100
3 1
2 4
3 1


Output

EMPTY SET
5
99
5

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18;
struct cht {
  vector<pair<int, int> > hull;
  int cur = 0;
  cht() { hull.clear(); }
  bool useless(const pair<int, int> left, const pair<int, int> middle,
               const pair<int, int> right) {
    return 1LL * (middle.second - left.second) * (middle.first - right.first) >=
           1LL * (right.second - middle.second) * (left.first - middle.first);
  }
  void insert(int a, int b) {
    if (hull.empty()) {
      hull.emplace_back(make_pair(a, b));
    } else {
      if (hull.back().first == a) {
        if (hull.back().second >= b) {
          return;
        } else {
          hull.pop_back();
        }
      }
      while (hull.size() >= 2 &&
             useless(hull[hull.size() - 2], hull.back(), make_pair(a, b))) {
        hull.pop_back();
      }
      hull.emplace_back(make_pair(a, b));
    }
  }
  double meet(const pair<int, int> x, const pair<int, int> y) {
    return 1.0 * (y.second - x.second) / (x.first - y.first);
  }
  long long query(int x) {
    if (hull.empty()) {
      return -inf;
    }
    while (((cur + 1) < hull.size()) && meet(hull[cur], hull[cur + 1]) < x) {
      ++cur;
    }
    return 1LL * hull[cur].first * x + hull[cur].second;
  }
};
const int N = 3e5 + 5;
const int SN = 1 << 20;
int n;
int type[N];
int a[N];
int b[N];
int x[N];
cht segtree[SN];
void update(int l, int r, int node, int ql, int qr, int a, int b) {
  if (l > qr || r < ql) {
    return;
  }
  if (l >= ql && r <= qr) {
    segtree[node].insert(a, b);
    return;
  }
  int mid = l + r >> 1;
  update(l, mid, node + node, ql, qr, a, b);
  update(mid + 1, r, node + node + 1, ql, qr, a, b);
}
long long query(int l, int r, int node, int idx, int val) {
  long long ret = segtree[node].query(val);
  if (l < r) {
    int mid = l + r >> 1;
    if (idx <= mid) {
      ret = max(ret, query(l, mid, node + node, idx, val));
    } else {
      ret = max(ret, query(mid + 1, r, node + node + 1, idx, val));
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &type[i]);
    if (type[i] == 1) {
      scanf("%d %d", &a[i], &b[i]);
      x[i] = n;
    } else if (type[i] == 2) {
      scanf("%d", &x[i]);
      x[x[i]] = i - 1;
    } else {
      scanf("%d", &x[i]);
    }
  }
  vector<pair<int, int> > vv;
  vv.clear();
  for (int i = 1; i <= n; ++i) {
    if (type[i] == 1) {
      vv.emplace_back(make_pair(a[i], i));
    }
  }
  sort(vv.begin(), vv.end());
  for (auto it : vv) {
    update(1, n, 1, it.second, x[it.second], it.first, b[it.second]);
  }
  vv.clear();
  for (int i = 1; i <= n; ++i) {
    if (type[i] == 3) {
      vv.emplace_back(make_pair(x[i], i));
    }
  }
  sort(vv.begin(), vv.end());
  vector<pair<int, long long> > ans;
  ans.clear();
  for (auto it : vv) {
    ans.emplace_back(make_pair(it.second, query(1, n, 1, it.second, it.first)));
  }
  sort(ans.begin(), ans.end());
  for (auto it : ans) {
    if (it.second <= -inf) {
      printf("EMPTY SET\n");
    } else {
      printf("%lld\n", it.second);
    }
  }
}