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 int N = 300005;
using ll = long long;
int n, tp[N], x[N], y[N];
ll ans[N], q[N];
bool vis[N];
struct TNode {
  int l, r;
  vector<pair<int, int>> v;
} t[N << 2];
inline int lc(int pos) { return pos << 1; }
inline int rc(int pos) { return pos << 1 | 1; }
void build(int pos, int l, int r) {
  t[pos].l = l;
  t[pos].r = r;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(lc(pos), l, mid);
  build(rc(pos), mid + 1, r);
}
void ins(int pos, int l, int r, pair<int, int> v) {
  if (t[pos].l == l && t[pos].r == r) {
    t[pos].v.push_back(v);
    return;
  }
  int mid = (t[pos].l + t[pos].r) >> 1;
  if (r <= mid)
    ins(lc(pos), l, r, v);
  else if (l > mid)
    ins(rc(pos), l, r, v);
  else
    ins(lc(pos), l, mid, v), ins(rc(pos), mid + 1, r, v);
}
pair<int, int> p[N];
int ptr;
void query(int pos) {
  int l = 0, r = ptr - 1;
  while (l <= r - 3) {
    int mid1 = (l + l + r) / 3, mid2 = (l + r + r) / 3;
    if (p[mid1].first * q[pos] + p[mid1].second <
        p[mid2].first * q[pos] + p[mid2].second)
      l = mid1;
    else
      r = mid2;
  }
  for (int i = l; i <= r; i++)
    ans[pos] = max(ans[pos], p[i].first * q[pos] + p[i].second);
}
inline double slope(pair<int, int> x, pair<int, int> y) {
  return (x.second - y.second) / 1.0 / (x.first - y.first);
}
void solve(int l, int r, int pos = 1) {
  int mid = (l + r) >> 1;
  if (l < r) solve(l, mid, lc(pos)), solve(mid + 1, r, rc(pos));
  sort(t[pos].v.begin(), t[pos].v.end());
  ptr = 0;
  for (auto &i : t[pos].v) {
    while (ptr > 1 && (p[ptr - 1].first == i.first ||
                       slope(i, p[ptr - 1]) >= slope(p[ptr - 1], p[ptr - 2])))
      --ptr;
    p[ptr++] = i;
  }
  for (int i = l; i <= r; i++)
    if (tp[i] == 3) query(i);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  build(1, 1, n);
  for (int i = 1; i <= n; i++) {
    cin >> tp[i];
    int t;
    if (tp[i] == 1)
      cin >> x[i] >> y[i];
    else if (tp[i] == 2)
      cin >> t, ins(1, t, i - 1, {x[t], y[t]}), vis[t] = 1;
    else
      cin >> q[i], ans[i] = LLONG_MIN;
  }
  for (int i = 1; i <= n; i++)
    if (tp[i] == 1 && !vis[i]) ins(1, i, n, {x[i], y[i]});
  solve(1, n);
  for (int i = 1; i <= n; i++)
    if (tp[i] != 3)
      continue;
    else if (ans[i] == LLONG_MIN)
      cout << "EMPTY SET" << endl;
    else
      cout << ans[i] << endl;
  return 0;
}