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 line {
  long long a, b;
  double xleft;
  bool type;
  line(long long _a, long long _b) {
    a = _a;
    b = _b;
    type = 0;
  }
  bool operator<(const line &other) const {
    if (other.type) {
      return xleft < other.xleft;
    }
    return a > other.a;
  }
};
double meet(line x, line y) { return 1.0 * (y.b - x.b) / (x.a - y.a); }
struct cht {
  set<line> hull;
  cht() { hull.clear(); }
  bool hasleft(set<line>::iterator node) { return node != hull.begin(); }
  bool hasright(set<line>::iterator node) { return node != prev(hull.end()); }
  void updateborder(set<line>::iterator node) {
    if (hasright(node)) {
      line temp = *next(node);
      hull.erase(temp);
      temp.xleft = meet(*node, temp);
      hull.insert(temp);
    }
    if (hasleft(node)) {
      line temp = *node;
      temp.xleft = meet(*prev(node), temp);
      hull.erase(node);
      hull.insert(temp);
    } else {
      line temp = *node;
      hull.erase(node);
      temp.xleft = -1e18;
      hull.insert(temp);
    }
  }
  bool useless(line left, line middle, line right) {
    double x = meet(left, right);
    double y = x * middle.a + middle.b;
    double ly = left.a * x + left.b;
    return y > ly;
  }
  bool useless(set<line>::iterator node) {
    if (hasleft(node) && hasright(node)) {
      return useless(*prev(node), *node, *next(node));
    }
    return 0;
  }
  void addline(long long a, long long b) {
    line temp = line(a, b);
    auto it = hull.lower_bound(temp);
    if (it != hull.end() && it->a == a) {
      if (it->b > b) {
        hull.erase(it);
      } else {
        return;
      }
    }
    hull.insert(temp);
    it = hull.find(temp);
    if (useless(it)) {
      hull.erase(it);
      return;
    }
    while (hasleft(it) && useless(prev(it))) {
      hull.erase(prev(it));
    }
    while (hasright(it) && useless(next(it))) {
      hull.erase(next(it));
    }
    updateborder(it);
  }
  long long getbest(long long x) {
    if (hull.empty()) {
      return 2e18;
    }
    line query(0, 0);
    query.xleft = x;
    query.type = 1;
    auto it = hull.lower_bound(query);
    it = prev(it);
    return it->a * x + it->b;
  }
};
const int N = 3e5 + 5;
const int SN = 1 << 20;
int n;
int type[N];
int a[N];
int b[N];
int x[N];
cht segtree[SN];
void update(int l, int r, int node, int ql, int qr, int a, int b) {
  if (l > qr || r < ql) {
    return;
  }
  if (l >= ql && r <= qr) {
    segtree[node].addline(-a, -b);
    return;
  }
  int mid = l + r >> 1;
  update(l, mid, node + node, ql, qr, a, b);
  update(mid + 1, r, node + node + 1, ql, qr, a, b);
}
long long query(int l, int r, int node, int idx, int val) {
  long long ret = -segtree[node].getbest(val);
  if (l < r) {
    int mid = l + r >> 1;
    if (idx <= mid) {
      ret = max(ret, query(l, mid, node + node, idx, val));
    } else {
      ret = max(ret, query(mid + 1, r, node + node + 1, idx, val));
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &type[i]);
    if (type[i] == 1) {
      scanf("%d %d", &a[i], &b[i]);
      x[i] = n;
    } else if (type[i] == 2) {
      scanf("%d", &x[i]);
      x[x[i]] = i - 1;
    } else {
      scanf("%d", &x[i]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (type[i] == 1) {
      update(1, n, 1, i, x[i], a[i], b[i]);
    } else if (type[i] == 3) {
      long long ans = query(1, n, 1, i, x[i]);
      if (ans <= -2e18) {
        printf("EMPTY SET\n");
      } else {
        printf("%lld\n", ans);
      }
    }
  }
}