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;
template <class T>
inline T bigmod(T p, T e, T M) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    T t = bigmod(p, e / 2, M);
    return (t * t) % M;
  }
  return (bigmod(p, e - 1, M) * p) % M;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T multimod(T a, T b, T m) {
  T ans = 0ll;
  a %= m, b %= m;
  while (b) {
    if (b & 1ll) ans = m - ans > a ? (ans + a) : (ans + a - m);
    b >>= 1ll;
    a = (m - a) > a ? a + a : a + a - m;
  }
  return (T)ans;
}
void sc(int &a) { scanf("%d", &a); }
void sc(long long &a) { scanf("%lld", &a); }
void sc(double &a) { scanf("%lf", &a); }
void sc(int &a, int &b) { scanf("%d %d", &a, &b); }
void sc(long long &a, long long &b) { scanf("%lld %lld", &a, &b); }
void sc(int &a, int &b, int &c) { scanf("%d %d %d", &a, &b, &c); }
void sc(int &a, int &b, long long &c) { scanf("%d %d %lld", &a, &b, &c); }
void sc(long long &a, long long &b, long long &c) {
  scanf("%lld %lld %lld", &a, &b, &c);
}
void sc(string &str) { cin >> str; }
void sc(char *(str)) { scanf(" %s", str); }
void sc(char &c) { scanf(" %c", &c); }
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 = -2000000000000000000LL;
      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 m, long long c) {
    line temp = line(m, c);
    auto it = hull.lower_bound(temp);
    if (it != hull.end() && it->a == m) {
      if (it->b > c) {
        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 2000000000000000000LL;
    }
    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;
  }
};
cht tree[(300000 * 4 + 10) * 4];
long long m, c;
void insert(int ind, int st, int ed, int l, int r) {
  if (st >= l && ed <= r) {
    tree[ind].addline(m, c);
    return;
  }
  int mid = (st + ed) / 2;
  if (r <= mid)
    insert(ind * 2, st, mid, l, r);
  else if (l > mid)
    insert(ind * 2 + 1, mid + 1, ed, l, r);
  else {
    insert(ind * 2, st, mid, l, mid);
    insert(ind * 2 + 1, mid + 1, ed, mid + 1, r);
  }
  return;
}
long long ans, x;
void query(int ind, int st, int ed, int pos) {
  ans = max(ans, tree[ind].getbest(x) * (-1ll));
  if (st == ed) {
    return;
  }
  int mid = (st + ed) / 2;
  if (pos <= mid)
    query(ind * 2, st, mid, pos);
  else
    query(ind * 2 + 1, mid + 1, ed, pos);
}
long long arr[(300000 + 7)];
long long cc[(300000 + 7)];
int type[(300000 + 7)];
int nxt[(300000 + 7)];
int main() {
  int i, j, k;
  int n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %lld", &type[i], &arr[i]);
    if (type[i] == 1) {
      scanf("%lld", &cc[i]);
      nxt[i] = n;
    } else if (type[i] == 2) {
      nxt[arr[i]] = i;
    }
  }
  for (i = 1; i <= n; i++) {
    if (type[i] == 1) {
      m = -arr[i], c = -cc[i];
      insert(1, 1, n, i, nxt[i]);
    } else if (type[i] == 3) {
      x = arr[i];
      ans = -1001000000000000009ll;
      query(1, 1, n, i);
      if (ans == -1001000000000000009ll)
        printf("EMPTY SET\n");
      else
        printf("%lld\n", ans);
    }
  }
  return 0;
}