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>
#pragma comment(linker, "/STACK:667772160")
using namespace std;
struct __isoff {
  __isoff() {
    if (0) freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
    srand('C' + 'T' + 'A' + 'C' + 'Y' + 'M' + 'B' + 'A');
  }
  ~__isoff() {}
} __osafwf;
const unsigned long long p1 = 123123;
const unsigned long long p2 = 12321;
const double eps = 1e-6;
const double pi = acos(-1.0);
const long long inf = 1e18 + 7;
const double infd = 1e25 + 7;
const int infi = 1e9 + 7;
const long long dd = 1e4 + 7;
const long long maxN = 1e5 + 7;
const long long sh = 4501;
const long long mod = 1e9 + 7;
const long long mod2 = 100003;
const int sqr = 3000;
vector<int> T, A, B;
vector<int> R;
vector<double> Lx;
vector<pair<long long, long long> > Q;
void build(vector<int> G) {
  vector<pair<long long, long long> > E;
  for (long long i = 0; i < (long long)G.size(); i++) {
    E.push_back(make_pair(A[G[i]], B[G[i]]));
  }
  sort(E.begin(), E.end());
  {
    vector<pair<long long, long long> > W;
    for (long long i = 0; i < (long long)E.size(); i++) {
      if (i + 1 == E.size() || E[i].first != E[i + 1].second) {
        W.push_back(E[i]);
      }
    }
    E = W;
  }
  Lx.clear();
  Q.clear();
  if (G.size() == 0) {
    return;
  }
  Lx.push_back(-infd);
  Q.push_back(E[0]);
  for (long long i = (long long)1; i < (long long)E.size(); i++) {
    while (1) {
      double a = Q.back().first;
      double b = Q.back().second;
      double q = E[i].first;
      double c = E[i].second;
      double x = (c - b) / (a - q);
      if (x > Lx.back() + eps) {
        Lx.push_back(x);
        Q.push_back(E[i]);
        break;
      } else {
        Lx.pop_back();
        Q.pop_back();
      }
    }
  }
}
long long get(long long x) {
  if (Lx.size() == 0) {
    return -inf * 2;
  }
  int e = lower_bound(Lx.begin(), Lx.end(), x) - Lx.begin();
  long long f = x * Q[e - 1].first + Q[e - 1].second;
  return f;
}
int main() {
  int n;
  cin >> n;
  T.resize(n);
  A.resize(n);
  B.resize(n);
  R.resize(n, infi);
  for (long long i = 0; i < (long long)n; i++) {
    scanf("%d", &T[i]);
    if (T[i] == 1) {
      scanf("%d%d", &A[i], &B[i]);
    }
    if (T[i] == 2) {
      scanf("%d", &A[i]);
      A[i]--;
      R[A[i]] = i;
    }
    if (T[i] == 3) {
      scanf("%d", &A[i]);
    }
  }
  for (int i = 0; i < n; i += sqr) {
    int r = min(i + sqr, n);
    vector<int> G;
    vector<int> W;
    for (long long j = 0; j < (long long)i; j++) {
      if (T[j] == 1) {
        if (R[j] >= r) {
          G.push_back(j);
        } else {
          if (R[j] >= i) {
            W.push_back(j);
          }
        }
      }
    }
    build(G);
    for (int j = i; j < n && j < i + sqr; j++) {
      if (T[j] == 1) {
        W.push_back(j);
      }
      if (T[j] == 2) {
        W.erase(find(W.begin(), W.end(), A[j]));
      }
      if (T[j] == 3) {
        long long res = -inf * 2;
        long long x = A[j];
        for (long long k = 0; k < (long long)W.size(); k++) {
          res = max(res, x * A[W[k]] + B[W[k]]);
        }
        res = max(res, get(x));
        if (res == -inf * 2) {
          cout << "EMPTY SET\n";
        } else {
          cout << res << '\n';
        }
      }
    }
  }
}