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;
void bad(string mes = "Impossible") {
  cout << mes;
  exit(0);
}
template <typename... T>
void shit(T&... x) {}
template <typename... T>
void dec(T&... x) {
  shit(--x...);
}
template <typename... T>
void inc(T&... x) {
  shit(++x...);
}
template <typename T>
string bin(T x, int st = 2) {
  string ans = "";
  while (x > 0) {
    ans += char('0' + x % st);
    x /= st;
  }
  reverse(ans.begin(), ans.end());
  return ans.empty() ? "0" : ans;
}
template <typename T>
T input() {
  T ans = 0, m = 1;
  char c = ' ';
  while (!((c >= '0' && c <= '9') || c == '-')) {
    c = getchar();
  }
  if (c == '-') m = -1, c = getchar();
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + (c - '0'), c = getchar();
  }
  return ans * m;
}
template <typename T>
void read(T& a) {
  a = input<T>();
}
template <typename T>
void read(T& a, T& b) {
  read(a), read(b);
}
template <typename T>
void read(T& a, T& b, T& c) {
  read(a, b), read(c);
}
template <typename T>
void read(T& a, T& b, T& c, T& d) {
  read(a, b), read(c, d);
}
const int inf = 1e9;
const double eps = 1e-9;
const int maxn = 3e5 + 15, base = 1e9 + 7;
const long long llinf = 2e18;
template <typename T>
T binpow(T n, T second) {
  if (second <= 0) return 1LL;
  if (second % 2 == 0) {
    T b = binpow(n, second / 2);
    return (1LL * b * b) % base;
  } else {
    return (1LL * binpow(n, second - 1) * n) % base;
  }
}
int timeA[maxn], timeD[maxn];
vector<pair<int, int> > Query, tree[4 * maxn], convHull;
pair<int, int> line[maxn];
void add(int v, int tl, int tr, int l, int r, pair<int, int>& curL) {
  if (l > r) return;
  if (tl == l && tr == r) {
    tree[v].push_back(curL);
    return;
  }
  int tm = (tl + tr) >> 1;
  add(v << 1, tl, tm, l, min(r, tm), curL);
  add(v << 1 | 1, tm + 1, tr, max(l, tm + 1), r, curL);
}
pair<int, int>& Back() { return convHull.back(); }
pair<int, int>& afterB() { return convHull[convHull.size() - 2]; }
void build(int v, int tl, int tr) {
  sort(tree[v].begin(), tree[v].end());
  convHull.clear();
  for (auto cur : tree[v]) {
    while (convHull.size() > 0 && Back().first == cur.first)
      convHull.pop_back();
    while (convHull.size() > 1 && 1LL * (cur.first - afterB().first) *
                                          (Back().second - afterB().second) <=
                                      1LL * (cur.second - afterB().second) *
                                          (Back().first - afterB().first))
      convHull.pop_back();
    convHull.push_back(cur);
  }
  tree[v].clear();
  tree[v] = convHull;
  if (tl == tr) {
    return;
  }
  int tm = (tl + tr) >> 1;
  build(v << 1, tl, tm);
  build(v << 1 | 1, tm + 1, tr);
}
long long CHT_query(int v, int x) {
  if (tree[v].empty()) return -1LL * llinf;
  if (tree[v].size() == 1)
    return 1LL * tree[v][0].first * x + tree[v][0].second;
  int l = 0, r = tree[v].size() - 1;
  while (r - l > 1) {
    int m = (l + r) >> 1;
    if (1LL * tree[v][m].first * x + tree[v][m].second >=
        1LL * tree[v][m + 1].first * x + tree[v][m + 1].second)
      r = m;
    else
      l = m;
  }
  return max(1LL * tree[v][l].first * x + tree[v][l].second,
             1LL * tree[v][r].first * x + tree[v][r].second);
}
long long query(int v, int tl, int tr, int curTime, int x) {
  if (tl == tr) {
    return CHT_query(v, x);
  }
  int tm = (tl + tr) >> 1;
  if (curTime <= tm)
    return max(CHT_query(v, x), query(v << 1, tl, tm, curTime, x));
  return max(CHT_query(v, x), query(v << 1 | 1, tm + 1, tr, curTime, x));
}
int main() {
  int n;
  read(n);
  for (int i = 0; i < n; i++) timeA[i] = -1, timeD[i] = n - 1;
  for (int i = 0; i < n; i++) {
    int type;
    read(type);
    if (type == 1) {
      int k, b;
      read(k, b);
      timeA[i] = i;
      line[i] = {k, b};
    }
    if (type == 2) {
      int pos;
      read(pos);
      pos--;
      timeD[pos] = i - 1;
    }
    if (type == 3) {
      int q;
      read(q);
      Query.push_back(make_pair(q, i));
    }
  }
  for (int i = 0; i < n; i++)
    if (timeA[i] != -1) {
      add(1, 0, n, timeA[i], timeD[i], line[i]);
    }
  build(1, 0, n);
  for (auto i : Query) {
    int x = i.first, curTime = i.second;
    long long res = query(1, 0, n, curTime, x);
    if (res == -1LL * llinf)
      puts("EMPTY SET");
    else
      printf("%I64d\n", res);
  }
  return 0;
}