#include<iostream>
#include<queue>
using namespace std;
struct cmp {
    bool operator ()(const pair<int, int> a, const pair<int, int> b) {
        if (a.first * a.first + a.second * a.second == b.first * b.first + b.second * b.second)
            return a.second < b.second;
        else if (a.first * a.first + a.second * a.second > b.first * b.first + b.second * b.second)
            return false;
        else
            return true;
    }
};
int main()
{
    int n;
    string str, num;
    while (cin >> n) {
        priority_queue<pair<int, int>, vector<pair<int, int>>, cmp > qu;
        for (int i = 0; i < n; ++i) {
            cin >> str;
            if (str == "Pop") {
                if (qu.empty()) {
                    cout << "empty" << endl;
                }
                else {
                    pair<int, int> t = qu.top();
                    cout << t.first << "+" << "i" << t.second << endl;
                    qu.pop();
                    cout << "SIZE = " << qu.size() << endl;
                }
            }
            else {
                cin >> num;
                int pos = num.find("+"),a = 0,b = 0;
                if (pos != string::npos) {
                    a = atoi(num.substr(0,pos).c_str());
                    b = atoi(num.substr(pos + 2, num.size() - 1 - pos).c_str());
                }
                qu.push(pair<int, int>(a,b));
                cout << "SIZE = " << qu.size() << endl;
            }
        }
    }
}