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 = 301010;
int n, op[N], a[N], b[N], c[N];
vector<pair<int, int> > v[N << 1];
void Ins(int l, int r, int L, int R, pair<int, int> p) {
  int c = (l + r) | (l != r), mid = (l + r) >> 1;
  if (L <= l && r <= R)
    v[c].push_back(p);
  else {
    if (L <= mid) Ins(l, mid, L, R, p);
    if (R > mid) Ins(mid + 1, r, L, R, p);
  }
}
long long ans;
bool vis[N << 1];
long long cross(pair<int, int>& a, pair<int, int>& b, pair<int, int>& c) {
  return (long long)(b.first - a.first) * (c.second - a.second) -
         (long long)(c.first - a.first) * (b.second - a.second);
}
long long gt(pair<int, int>& a, long long p) { return a.first * p + a.second; }
void Query(int c, vector<pair<int, int> >& v, int p) {
  if ((int)(v).size() == 0) return;
  if (!vis[c]) {
    vis[c] = true;
    sort((v).begin(), (v).end());
    vector<pair<int, int> > nv;
    for (int i = 0; i < ((int)(v).size()); ++i) {
      while ((int)(nv).size() >= 2 &&
             cross(nv[(int)(nv).size() - 2], nv[(int)(nv).size() - 1], v[i]) >=
                 0)
        nv.pop_back();
      nv.push_back(v[i]);
    }
    v = nv;
  }
  int l = -1, r = (int)(v).size() - 1;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (gt(v[mid], p) >= gt(v[mid + 1], p))
      r = mid;
    else
      l = mid;
  }
  ans = max(ans, gt(v[r], p));
}
void Query(int l, int r, int x, int p) {
  int c = (l + r) | (l != r), mid = (l + r) >> 1;
  Query(c, v[c], p);
  if (l == r)
    return;
  else if (x <= mid)
    Query(l, mid, x, p);
  else if (x > mid)
    Query(mid + 1, r, x, p);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < (n + 1); ++i) {
    scanf("%d%d", op + i, a + i);
    if (op[i] == 1)
      scanf("%d", b + i), c[i] = n;
    else if (op[i] == 2)
      c[a[i]] = i;
  }
  for (int i = 1; i < (n + 1); ++i)
    if (op[i] == 1) Ins(1, n, i, c[i], make_pair(a[i], b[i]));
  for (int i = 1; i < (n + 1); ++i)
    if (op[i] == 3) {
      ans = -(1ll << 62);
      Query(1, n, i, a[i]);
      if (ans == -(1ll << 62))
        puts("EMPTY SET");
      else
        printf("%I64d\n", ans);
    }
  return 0;
}