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 = 300010;
int n, out[N], in[N], q[N], tot;
pair<int, int> p[N];
long long ans[N];
bool pd[N];
vector<pair<int, int> > v[N * 4], tmp;
struct Node {
  int l, r;
} t[N * 4];
void build(int x, int l, int r) {
  t[x].l = l, t[x].r = r;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(x * 2, l, mid);
  build(x * 2 + 1, mid + 1, r);
}
void insert(int x, int l, int r, pair<int, int> &p) {
  if (l == t[x].l && r == t[x].r) {
    v[x].push_back(p);
    return;
  }
  int mid = (t[x].l + t[x].r) / 2;
  if (r <= mid)
    insert(x * 2, l, r, p);
  else if (l > mid)
    insert(x * 2 + 1, l, r, p);
  else
    insert(x * 2, l, mid, p), insert(x * 2 + 1, mid + 1, r, p);
}
void retrieve(int x) {
  sort(v[x].begin(), v[x].end());
  tmp.clear();
  int tail = 0;
  for (int i = 0; i < v[x].size(); i++) {
    while (tail >= 2 && 1ll * (tmp[tail - 2].first - tmp[tail - 1].first) *
                                (tmp[tail - 1].second - v[x][i].second) >=
                            1ll *
                                (tmp[tail - 2].second - tmp[tail - 1].second) *
                                (tmp[tail - 1].first - v[x][i].first))
      tmp.pop_back(), tail--;
    tmp.push_back(v[x][i]);
    tail++;
  }
  v[x] = tmp;
  if (t[x].l == t[x].r) {
    int k = -q[t[x].l];
    bool flag = false;
    long long res = -2e18;
    int now = x, l, r, mid;
    while (now) {
      l = 0, r = v[now].size() - 1;
      while (l < r) {
        mid = (l + r) / 2;
        if (1ll * k * (v[now][mid].first - v[now][mid + 1].first) >=
            v[now][mid].second - v[now][mid + 1].second)
          l = mid + 1;
        else
          r = mid;
      }
      if (r >= 0) {
        flag = true;
        res = max(res, 1ll * v[now][l].first * q[t[x].l] + v[now][l].second);
      }
      now >>= 1;
    }
    if (flag) {
      pd[t[x].l] = true;
      ans[t[x].l] = res;
    }
    return;
  }
  retrieve(x * 2);
  retrieve(x * 2 + 1);
}
int main() {
  scanf("%d", &n);
  int t, x, y;
  tot = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d", &x, &y);
      p[i] = make_pair(x, y);
      in[i] = tot + 1;
      pd[i] = true;
      out[i] = -1;
    } else if (t == 2) {
      scanf("%d", &x);
      out[x] = tot;
    } else {
      scanf("%d", &x);
      q[++tot] = x;
    }
  }
  if (tot == 0) return 0;
  build(1, 1, tot);
  for (int i = 1; i <= n; i++)
    if (pd[i]) {
      if (out[i] == -1) out[i] = tot;
      if (in[i] <= out[i]) insert(1, in[i], out[i], p[i]);
    }
  memset(pd, false, sizeof(pd));
  retrieve(1);
  for (int i = 1; i <= tot; i++)
    if (pd[i])
      printf("%I64d\n", ans[i]);
    else
      puts("EMPTY SET");
  return 0;
}