#include <bits/stdc++.h>
using namespace std;

struct num{
    int a;
    int b;
};

bool cmp(num n1,num n2){
    int c1=n1.a*n1.a+n1.b*n1.b,c2=n2.a*n2.a+n2.b*n2.b;
    if(c1!=c2)
        return c1<c2;
    return n1.b>n2.b;
}

int main() {
    int n,size;
    char c;
    string s;
    while (cin >> n) { // 注意 while 处理多个 case
        size=0;
        vector<num>v(n);
        for(int i=0;i<n;i++){
            cin>>s;
            if(s=="Pop")
                if(!size)
                    cout<<"empty"<<endl;
                else{
                    sort(&v[0],&v[size--],cmp);
                    cout<<v[size].a<<"+i"<<v[size].b<<endl;
                    cout<<"SIZE = "<<size<<endl;
                }
            else if(s=="Insert"){
                cin>>v[size].a>>c>>c>>v[size].b;
                cout<<"SIZE = "<<++size<<endl;
            }
        }
    }
}
// 64 位输出请用 printf("%lld")