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;
long long read() {
  long long a = 0, b = getchar(), c = 1;
  while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar();
  while (isdigit(b)) a = a * 10 + b - '0', b = getchar();
  return a * c;
}
const int M = 3e5 + 5;
struct node {
  long long x, y, id;
  bool operator<(const node &A) const {
    if (x != A.x) return x < A.x;
    return y < A.y;
  }
} s[M];
long long n, a[M], q[M], ki[M], st[M], ed[M], ans[M];
long long gg(long long k, long long ab) {
  int l = 1, r = ab;
  while (l < r) {
    int mid = l + r >> 1;
    if (k * s[q[mid]].x + s[q[mid]].y > k * s[q[mid + 1]].x + s[q[mid + 1]].y)
      r = mid;
    else
      l = mid + 1;
  }
  if (ab) return k * s[q[l]].x + s[q[l]].y;
  return -3e18;
}
void query(long long l, long long r, long long ab) {
  for (int i = l; i <= r; i++)
    if (a[s[i].id] == 3) ans[s[i].id] = max(ans[s[i].id], gg(ki[s[i].id], ab));
}
void gao(long long l, long long r) {
  if (l == r) return;
  int mid = l + r >> 1;
  gao(l, mid), gao(mid + 1, r);
  sort(s + l, s + mid + 1);
  int ab = 0;
  for (int i = l; i <= mid; i++) {
    if (a[s[i].id] != 1 or ed[s[i].id] <= r) continue;
    while (ab > 1 and (s[i].y - s[q[ab]].y) * (s[i].x - s[q[ab - 1]].x) >=
                          (s[i].x - s[q[ab]].x) * (s[i].y - s[q[ab - 1]].y))
      ab--;
    q[++ab] = i;
  }
  query(mid + 1, r, ab);
  sort(s + mid + 1, s + r + 1);
  ab = 0;
  for (int i = mid + 1; i <= r; i++) {
    if (a[s[i].id] != 2 or st[s[i].id] >= l) continue;
    while (ab > 1 and (s[i].y - s[q[ab]].y) * (s[i].x - s[q[ab - 1]].x) >=
                          (s[i].x - s[q[ab]].x) * (s[i].y - s[q[ab - 1]].y))
      ab--;
    q[++ab] = i;
  }
  query(l, mid, ab);
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    ans[i] = -3e18, a[i] = read(), s[i].id = i;
    if (a[i] == 1) {
      s[i].x = read(), s[i].y = read();
      ed[i] = n + 1;
    } else if (a[i] == 3)
      ki[i] = read();
    else {
      int x = read();
      s[i].x = s[x].x;
      s[i].y = s[x].y;
      ed[x] = i, st[i] = x;
    }
  }
  gao(1, n);
  for (int i = 1; i <= n; i++)
    if (a[i] == 3) {
      if (ans[i] == -3e18)
        puts("EMPTY SET");
      else
        printf("%lld\n", ans[i]);
    }
  return 0;
}