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 node {
  long long x, y;
  void input() { scanf("%I64d%I64d", &x, &y); }
  node operator+(const node& tt) const { return node(x + tt.x, y + tt.y); }
  node operator-(const node& tt) const { return node(x - tt.x, y - tt.y); }
  long long operator^(const node& tt) const { return x * tt.y - y * tt.x; }
  long long operator*(const node& tt) const { return x * tt.x + y * tt.y; }
  bool operator<(const node& tt) const {
    if (x != tt.x) return x < tt.x;
    return y < tt.y;
  }
  node(long long a = 0, long long b = 0) : x(a), y(b) {}
} tmp[300005], stk[300005];
vector<node> t[300005 << 2];
int n, q[300005], id[300005], l[300005], r[300005], cc = 0;
void update(int r, int L, int R, int ll, int rr, const node& tt) {
  int mid = L + R >> 1;
  if (L == ll && R == rr) {
    t[r].push_back(tt);
    return;
  }
  if (rr <= mid)
    update(r << 1, L, mid, ll, rr, tt);
  else if (ll > mid)
    update(r << 1 | 1, mid + 1, R, ll, rr, tt);
  else {
    update(r << 1, L, mid, ll, mid, tt);
    update(r << 1 | 1, mid + 1, R, mid + 1, rr, tt);
  }
}
long long ans[300005];
long long calc(int l, int r, int x) {
  int m1, m2;
  node tt(x, 1);
  while (l < r) {
    m1 = l + r >> 1;
    m2 = m1 + r + 1 >> 1;
    if (stk[m1] * tt < stk[m2] * tt)
      l = m1 + 1;
    else
      r = m2 - 1;
  }
  return stk[l] * tt;
}
void solve(int r, int L, int R) {
  int top = 0, mid = L + R >> 1;
  if (L < R) {
    solve(r << 1, L, mid);
    solve(r << 1 | 1, mid + 1, R);
  }
  sort(t[r].begin(), t[r].end());
  for (int i = 0, j = t[r].size(); i < j; ++i) {
    while (top > 1 &&
           ((stk[top - 1] - stk[top - 2]) ^ (t[r][i] - stk[top - 2])) >= 0)
      --top;
    stk[top++] = t[r][i];
  }
  for (int i = L; i <= R; ++i)
    if (q[i] <= 1e9 && top) ans[i] = max(ans[i], calc(0, top - 1, q[i]));
}
int main() {
  memset(q, 0x7f, sizeof(q));
  scanf("%d", &n);
  int c, a, b;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &c);
    if (c == 3) {
      scanf("%d", q + i);
      ans[i] = -9.05e18;
      continue;
    }
    if (c == 1) {
      id[i] = ++cc;
      tmp[cc].input();
      l[cc] = i;
      r[cc] = n;
    } else {
      scanf("%d", &a);
      r[id[a]] = i - 1;
    }
  }
  for (int i = 1; i <= cc; ++i) update(1, 1, n, l[i], r[i], tmp[i]);
  solve(1, 1, n);
  for (int i = 1; i <= n; ++i)
    if (q[i] <= 1e9) {
      if (ans[i] < -9e18)
        puts("EMPTY SET");
      else
        printf("%I64d\n", ans[i]);
    }
  return 0;
}