def ma(se):  # 求模长最大
    ans = []
    for i in range(len(se)):
        if "+" in se[i]:
            x = se[i].split("+")
            a = int(x[0]) ** 2 + int(x[1][1:]) ** 2
            ans.append(a)
        if "-" in se[i]:
            x = se[i].split("-")
            a = int(x[0]) ** 2 + int(x[1][1:]) ** 2
            ans.append(a)
    ind = 0
    max = 0
    for i in range(len(ans)):
        if ans[i] > max:
            ind = i
            max = ans[i]
    return ind


n = int(input())
se = []
for i in range(n):
    x = input()
    if x[0] == "I":  # 执行Insert
        el = (x.split(" "))[1]
        se.append(el)
        print("SIZE = ", end="")
        print(len(se))
    else:  # 执行Pop
        if len(se) == 0:
            print("empty")
        else:
            print(se[ma(se)])
            del se[ma(se)]
            print("SIZE = ", end="")
            print(len(se))