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 = 300005;
const long long INF = 2000000000000000000LL;
int n;
struct Point {
  int x, y;
  Point() {}
  Point(int x, int y) : x(x), y(y) {}
  bool operator<(const Point& c) const {
    if (x == c.x) return y < c.y;
    return x < c.x;
  }
  Point operator-(const Point& c) const { return Point(x - c.x, y - c.y); }
  long long operator*(const Point& c) const {
    return 1LL * x * c.y - 1LL * y * c.x;
  }
};
struct Node {
  vector<Point> p;
  vector<pair<int, int> > q;
} node[N * 4];
int tp[N], x[N], y[N];
long long ans[N];
void build(int L = 1, int R = n, int x = 1) {
  if (L == R) return;
  int mid = (L + R) >> 1;
  build(L, mid, (x << 1));
  build(mid + 1, R, ((x << 1) | 1));
}
void ins(pair<int, int> v, int L = 1, int R = n, int x = 1) {
  node[x].q.push_back(v);
  if (L == R) return;
  int mid = (L + R) >> 1;
  if (v.second <= mid)
    ins(v, L, mid, (x << 1));
  else
    ins(v, mid + 1, R, ((x << 1) | 1));
}
void add(int l, int r, Point p, int L = 1, int R = n, int x = 1) {
  if (L >= l && R <= r) {
    node[x].p.push_back(p);
    return;
  }
  int mid = (L + R) >> 1;
  if (l <= mid) add(l, r, p, L, mid, (x << 1));
  if (r > mid) add(l, r, p, mid + 1, R, ((x << 1) | 1));
}
Point st[N];
int top;
void gao(vector<Point> p) {
  sort(p.begin(), p.end());
  top = 0;
  for (int i = 0; i < p.size(); i++) {
    while (top >= 2 && (p[i] - st[top - 2]) * (st[top - 1] - st[top - 2]) <= 0)
      top--;
    st[top++] = p[i];
  }
}
long long cal(Point p, int q) { return 1LL * p.x * q + p.y; }
long long get(int q) {
  if (top == 0) return -INF;
  int l = 0, r = top - 1;
  while (l < r) {
    int ml = (l * 2 + r) / 3;
    int mr = (l + r * 2 + 2) / 3;
    if (cal(st[ml], q) < cal(st[mr], q))
      l = ml + 1;
    else
      r = mr - 1;
  }
  return cal(st[l], q);
}
void go(int L = 1, int R = n, int x = 1) {
  gao(node[x].p);
  for (int i = 0; i < node[x].q.size(); i++) {
    int w = node[x].q[i].first;
    int id = node[x].q[i].second;
    ans[id] = max(ans[id], get(w));
  }
  if (L == R) return;
  int mid = (L + R) >> 1;
  go(L, mid, (x << 1));
  go(mid + 1, R, ((x << 1) | 1));
}
int main() {
  scanf("%d", &n);
  build();
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &tp[i], &x[i]);
    if (tp[i] == 1)
      scanf("%d", &y[i]);
    else if (tp[i] == 2) {
      add(x[i], i, Point(x[x[i]], y[x[i]]));
      tp[x[i]] = 0;
    } else
      ins(make_pair(x[i], i));
    ans[i] = -INF;
  }
  for (int i = 1; i <= n; i++)
    if (tp[i] == 1) add(i, n, Point(x[i], y[i]));
  go();
  for (int i = 1; i <= n; i++) {
    if (tp[i] == 3) {
      if (ans[i] == -INF)
        printf("EMPTY SET\n");
      else
        printf("%lld\n", ans[i]);
    }
  }
  return 0;
}