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 int N = 3e5 + 7;
int n, l[N], r[N];
struct Point {
  long long x, y;
  Point(long long _x = 0, long long _y = 0) {
    x = _x;
    y = _y;
  }
  Point operator+(const Point &b) const { return Point(x + b.x, y + b.y); }
  Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); }
  bool operator<(const Point &b) const { return x == b.x ? y < b.y : x < b.x; }
} d[N];
double Cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
vector<Point> v0[N << 2], v[N << 2];
void add(int rt, int l, int r, int L, int R, Point &d) {
  if (L <= l && r <= R) {
    v0[rt].push_back(d);
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) add(rt << 1, l, mid, L, R, d);
  if (R > mid) add(rt << 1 | 1, mid + 1, r, L, R, d);
}
void build(int rt, int l, int r) {
  sort(begin(v0[rt]), end(v0[rt]));
  int num = 0, ll = (int)v0[rt].size() - 1;
  for (int i = int(0); i <= int(ll); ++i) {
    while (num > 1 && Cross(v[rt][num - 1] - v[rt][num - 2],
                            v0[rt][i] - v[rt][num - 1]) >= 0) {
      num--;
      v[rt].pop_back();
    }
    v[rt].push_back(v0[rt][i]);
    num++;
  }
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
}
long long calc(Point &p, long long x) { return p.x * x + p.y; }
long long ask(vector<Point> &v, long long x) {
  int L = 0, R = v.size() - 1;
  while (R - L > 2) {
    int lp = (L + L + R) / 3, rp = (L + R + R) / 3;
    if (calc(v[lp], x) > calc(v[rp], x))
      R = rp;
    else
      L = lp;
  }
  long long ret = -2e18;
  for (int i = int(L); i <= int(R); ++i) ret = max(ret, calc(v[i], x));
  return ret;
}
long long query(int rt, int l, int r, int pos, int x) {
  if (l == r) return ask(v[rt], x);
  int mid = (l + r) >> 1;
  long long ret = ask(v[rt], x);
  if (pos <= mid)
    ret = max(ret, query(rt << 1, l, mid, pos, x));
  else
    ret = max(ret, query(rt << 1 | 1, mid + 1, r, pos, x));
  return ret;
}
int main() {
  scanf("%d", &n);
  vector<pair<int, int> > q;
  int cmd, x, y;
  for (int i = int(1); i <= int(n); ++i) {
    scanf("%d", &cmd);
    if (cmd == 1) {
      scanf("%d%d", &x, &y);
      d[i] = Point(x, y);
      l[i] = i;
      r[i] = n;
    } else if (cmd == 2) {
      scanf("%d", &x);
      r[x] = i;
    } else {
      scanf("%d", &x);
      q.push_back(pair<int, int>(i, x));
    }
  }
  for (int i = int(1); i <= int(n); ++i)
    if (l[i]) add(1, 1, n, l[i], r[i], d[i]);
  build(1, 1, n);
  for (pair<int, int> p : q) {
    long long ans = query(1, 1, n, p.first, p.second);
    if (ans <= (long long)-2e18)
      cout << "EMPTY SET\n";
    else
      cout << ans << '\n';
  }
}