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. 1.  Remove a pair added in the query number *i*. All queries are numbered with integers from 1 to *n*. 1.  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.
The first line of input contains integer *n* (1 ≤ *n* ≤ 3·10<sup class="upper-index">5</sup>) — 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* ( - 10<sup class="upper-index">9</sup> ≤ *a*, *b* ≤ 10<sup class="upper-index">9</sup>) 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* ( - 10<sup class="upper-index">9</sup> ≤ *q* ≤ 10<sup class="upper-index">9</sup>) follows in the query of the third type.
none
7
3 1
1 2 3
3 1
1 -1 100
3 1
2 4
3 1
EMPTY SET
5
99
5
5
1 -1 2
1 0 -1
2 2
1 -2 -1
3 -1
3
3
1 -2 2
1 -3 0
3 -1
4
3
1 0 -2
1 2 -2
3 1
0
3
1 -1 0
1 -1 1
3 -2
3
10
3 -10
1 6 -2
1 8 -3
2 3
1 -6 -3
2 2
3 6
3 4
2 5
1 3 -9
EMPTY SET
-39
-27
10
3 0
3 0
3 0
3 0
1 0 0
1 0 0
1 0 0
3 0
3 0
2 6
EMPTY SET
EMPTY SET
EMPTY SET
EMPTY SET
0
0
1
3 840
EMPTY SET
4
1 -1000000000 0
3 1000000000
1 -1000000000 1
3 1000000000
-1000000000000000000
-999999999999999999
3
1 -1000000000 0
1 -1000000000 0
3 1000000000
-1000000000000000000
3
1 -1000000000 0
3 1000000000
2 1
-1000000000000000000
2
1 -1000000000 0
3 1000000000
-1000000000000000000
2
1 -1000000000 -7
3 1000000000
-1000000000000000007
2
1 -1000000000 -1000000000
3 1000000000
-1000000001000000000
import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def f(i, x):
    return a0[i] * x + b0[i]

def check(i, j, k):
    u = (a0[j] - a0[i]) * (b0[k] - b0[j])
    v = (b0[j] - b0[i]) * (a0[k] - a0[j])
    return True if u <= v else False

def add_line(a, b):
    if len(a0) and a0[-1] == a:
        b0[-1] = max(b0[-1], b)
    else:
        a0.append(a)
        b0.append(b)
    while len(a0) >= 3 and check(-3, -2, -1):
        a0[-2], b0[-2] = a0[-1], b0[-1]
        a0.pop()
        b0.pop()
    return

def get_max(x):
    global i0
    i0 = min(i0, len(a0) - 1)
    while i0 < len(a0) - 1 and f(i0, x) <= f(i0 + 1, x):
        i0 += 1
    return f(i0, x)

n = int(input())
inf = pow(10, 9) + 1
t, z = [], []
a, b = [0] * n, [0] * n
s = set()
for i in range(n):
    z0 = list(map(int, input().split()))
    t.append(z0[0])
    u = z0[1]
    if z0[0] == 1:
        u = z0[1] * n + i
        a[i], b[i] = z0[1], z0[2]
        s.add(u)
    elif z0[0] == 2:
        u -= 1
    z.append(u)
s = list(s)
s.sort()
d = dict()
l = len(s)
for i in range(l):
    d[s[i]] = i
now = [0] * l
m = 1234
ans0 = [-inf * inf] * n
c = [0] * n
s0 = 0
for i in range(n // m + min(n % m, 1)):
    x = []
    l0, r0 = i * m, min((i + 1) * m, n)
    for j in range(l0, r0):
        if t[j] == 2 and z[j] < l0:
            now[d[z[z[j]]]] = 0
            s0 -= 1
            x.append(z[j])
            c[z[j]] = len(x) - 1
    y = []
    for j in range(l0, r0):
        if t[j] == 1:
            x.append(j)
            c[j] = len(x) - 1
        elif t[j] == 2:
            x[c[z[j]]] = -1
        else:
            ans1 = ans0[j]
            q = z[j]
            for k in x:
                if k ^ -1:
                    ans1 = max(ans1, a[k] * q + b[k])
            ans0[j] = ans1
            y.append(q * n + j)
    if s0:
        a0, b0 = [], []
        for j in range(l):
            if now[j]:
                add_line(a[s[j] % n], b[s[j] % n])
        i0 = 0
        for j in sorted(y):
            u, k = divmod(j, n)
            ans0[k] = max(ans0[k], get_max(u))
    for j in range(l0, r0):
        if t[j] == 1:
            now[d[z[j]]] = 1
            s0 += 1
        elif t[j] == 2 and z[j] >= l0:
            now[d[z[z[j]]]] = 0
            s0 -= 1
ans = []
for i, j in zip(t, ans0):
    if i == 3:
        ans1 = str(j) if not j == -inf * inf else "EMPTY SET"
        ans.append(ans1)
sys.stdout.write("\n".join(ans))