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 jdb {
  int x, y;
  friend long long operator^(const jdb &a, const jdb &b) {
    return 1ll * a.x * b.y - 1ll * a.y * b.x;
  }
  friend long long operator*(const jdb &a, const jdb &b) {
    return 1ll * a.x * b.x + 1ll * a.y * b.y;
  }
  friend bool operator<(const jdb &a, const jdb &b) {
    return (a.x != b.x ? a.x < b.x : a.y < b.y);
  }
  friend jdb operator-(const jdb &a, const jdb &b) {
    return (jdb){a.x - b.x, a.y - b.y};
  }
} p[300005], st[300005];
struct que {
  int x, y;
  long long ans;
  que() { ans = -(1ll << 62); };
} q[300005];
vector<jdb> vec[300005 * 4];
int L[300005], pos[300005];
bool fl[300005], isq[300005];
int n, m, tot, top, cnt;
void insert(int k, int l, int r, int x, int y, int v) {
  if (l == x && r == y) {
    vec[k].push_back(p[v]);
    return;
  }
  int mid = (l + r) / 2;
  if (y <= mid)
    insert(k * 2, l, mid, x, y, v);
  else if (x > mid)
    insert(k * 2 + 1, mid + 1, r, x, y, v);
  else
    insert(k * 2, l, mid, x, mid, v),
        insert(k * 2 + 1, mid + 1, r, mid + 1, y, v);
}
void query(int i) {
  if (!top) return;
  jdb tmp = (jdb){q[i].x, q[i].y};
  int l = 1, r = top;
  while (r - l >= 3) {
    int m1 = l + (r - l) / 3;
    int m2 = r - (r - l) / 3;
    if (tmp * st[m1] > tmp * st[m2])
      r = m2;
    else
      l = m1;
  }
  for (int j = l; j <= r; j++) q[i].ans = max(q[i].ans, tmp * st[j]);
}
void solve(int k, int l, int r) {
  long long mid = (l + r) / 2;
  if (l < r) {
    solve(k * 2, l, mid);
    solve(k * 2 + 1, mid + 1, r);
  }
  top = 0;
  sort(vec[k].begin(), vec[k].end());
  for (int i = 0; i < vec[k].size(); i++) {
    for (; top > 1 && ((vec[k][i] - st[top]) ^ (st[top] - st[top - 1])) <= 0;
         top--)
      ;
    st[++top] = vec[k][i];
  }
  for (int i = l; i <= r; i++)
    if (isq[i]) query(i);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int tp, x, y;
    scanf("%d", &tp);
    if (tp == 1) {
      scanf("%d%d", &x, &y);
      p[++tot] = (jdb){x, y};
      L[tot] = i;
      pos[i] = tot;
      cnt++;
    }
    if (tp == 2) {
      scanf("%d", &x);
      x = pos[x];
      insert(1, 1, n, L[x], i, x);
      L[x] = 0;
      cnt--;
    }
    if (tp == 3) {
      scanf("%d", &q[i].x);
      q[i].y = 1;
      isq[i] = 1;
      if (!cnt) {
        fl[i] = 1;
        q[i].x = q[i].y = isq[i] = 0;
      }
    }
  }
  for (int i = 1; i <= tot; i++)
    if (L[i]) insert(1, 1, n, L[i], n, i);
  solve(1, 1, n);
  for (int i = 1; i <= n; i++) {
    if (fl[i]) puts("EMPTY SET");
    if (isq[i]) printf("%I64d\n", q[i].ans);
  }
}