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 long long int is_query = LLONG_MIN;
struct Line {
  long long int m, b;
  mutable function<const Line*()> succ;
  bool operator<(const Line& rhs) const {
    if (rhs.b != is_query) return m < rhs.m;
    const Line* s = succ();
    if (!s) return 0;
    long long int x = rhs.m;
    return b - s->b < (s->m - m) * x;
  }
};
struct HullDynamic : public multiset<Line> {
  bool bad(iterator y) {
    auto z = next(y);
    if (y == begin()) {
      if (z == end()) return 0;
      return y->m == z->m && y->b <= z->b;
    }
    auto x = prev(y);
    if (z == end()) return y->m == x->m && y->b <= x->b;
    return 1.0 * (x->b - y->b) * (z->m - y->m) >
           1.0 * (y->b - z->b) * (y->m - x->m);
  }
  void Add(long long int m, long long int b) {
    auto y = insert({m, b});
    y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
    if (bad(y)) {
      erase(y);
      return;
    }
    while (next(y) != end() && bad(next(y))) erase(next(y));
    while (y != begin() && bad(prev(y))) erase(prev(y));
  }
  long long int Query(long long int x) {
    auto l = lower_bound((Line){x, is_query});
    if (l == end()) return LLONG_MIN;
    return l->m * x + l->b;
  }
};
HullDynamic Tree[4 * 300005];
long long int query(int node, int lo, int hi, int i, int j, long long int x) {
  if (i > hi || j < lo) return LLONG_MIN;
  long long int ret = LLONG_MIN;
  ret = Tree[node].Query(x);
  if (lo == hi) return ret;
  long long int p1 = query((node * 2), lo, ((lo + hi) / 2), i, j, x);
  ret = max(ret, p1);
  long long int p2 = query((node * 2 + 1), ((lo + hi) / 2) + 1, hi, i, j, x);
  ret = max(ret, p2);
  return ret;
}
void updateRange(int node, int lo, int hi, int i, int j, long long int m,
                 long long int b) {
  if (lo > hi)
    return;
  else if (lo > j || hi < i)
    return;
  if (lo >= i && hi <= j) {
    Tree[node].Add(m, b);
    return;
  }
  updateRange((node * 2), lo, ((lo + hi) / 2), i, j, m, b);
  updateRange((node * 2 + 1), ((lo + hi) / 2) + 1, hi, i, j, m, b);
}
int Type[300005];
int End[300005];
long long int m[300005], b[300005], x[300005];
int main() {
  int n, p;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &Type[i]);
    if (Type[i] == 1) {
      scanf("%lld %lld", &m[i], &b[i]);
      End[i] = n;
    } else if (Type[i] == 2) {
      scanf("%d", &p);
      End[p] = i;
    } else
      scanf("%lld", &x[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (Type[i] == 1) updateRange(1, 1, n, i, End[i], m[i], b[i]);
    if (Type[i] == 3) {
      long long int ret = query(1, 1, n, i, i, x[i]);
      if (ret == LLONG_MIN)
        printf("EMPTY SET\n");
      else
        printf("%lld\n", ret);
    }
  }
}