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;
struct point {
  long long x, y;
  point(int a = 0, int b = 0) {
    x = a;
    y = b;
  }
};
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
long long operator*(point a, point b) { return a.x * b.y - a.y * b.x; }
bool operator<(point a, point b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}
vector<point> tag[1200010];
point p[300010];
int _end[300010];
long long ask[300010];
void modify(int L, int R, int l, int r, int x) {
  if (L <= l && r <= R) {
    tag[x].push_back(p[L]);
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) modify(L, R, l, mid, x << 1);
  if (mid < R) modify(L, R, mid + 1, r, x << 1 | 1);
}
void dfs(int l, int r, int x) {
  vector<point>& v = tag[x];
  if (!v.empty()) sort(v.begin(), v.end());
  if (v.size() > 2) {
    int i, j;
    for (i = 2, j = 1; i < v.size(); i++) {
      while (j > 0 && (v[j] - v[j - 1]) * (v[i] - v[j]) >= 0) j--;
      j++;
      v[j] = v[i];
    }
    while (v.size() > (j + 1)) v.pop_back();
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  dfs(l, mid, x << 1);
  dfs(mid + 1, r, x << 1 | 1);
}
long long ans;
long long calc(point p, long long v) { return p.x * v + p.y; }
long long solve(vector<point>& vt, long long v) {
  long long ans = -9223372036854775807ll;
  int i, l, r, m1, m2;
  l = 0;
  r = vt.size() - 1;
  while (r - l > 6) {
    m1 = (l * 2 + r) / 3;
    m2 = (l + r * 2) / 3;
    if (calc(vt[m1], v) < calc(vt[m2], v))
      l = m1;
    else
      r = m2;
  }
  for (i = l; i <= r; i++) ans = max(ans, calc(vt[i], v));
  return ans;
}
void query(int pos, long long v, int l, int r, int x) {
  ans = max(ans, solve(tag[x], v));
  if (l == r) return;
  int mid = (l + r) >> 1;
  if (pos <= mid)
    query(pos, v, l, mid, x << 1);
  else
    query(pos, v, mid + 1, r, x << 1 | 1);
}
int main() {
  int n, i, op, x;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    _end[i] = -1;
    ask[i] = -9223372036854775807ll;
    scanf("%d", &op);
    if (op == 1) {
      scanf("%I64d%I64d", &p[i].x, &p[i].y);
      _end[i] = n;
    }
    if (op == 2) {
      scanf("%d", &x);
      _end[x] = i - 1;
    }
    if (op == 3) scanf("%I64d", ask + i);
  }
  for (i = 1; i <= n; i++) {
    if (_end[i] != -1) modify(i, _end[i], 1, n, 1);
  }
  dfs(1, n, 1);
  for (i = 1; i <= n; i++) {
    if (ask[i] != -9223372036854775807ll) {
      ans = -9223372036854775807ll;
      query(i, ask[i], 1, n, 1);
      if (ans == -9223372036854775807ll)
        puts("EMPTY SET");
      else
        printf("%I64d\n", ans);
    }
  }
}