#include <iostream> #include <queue> using namespace std; struct complex{ int real; int hypo; int value; complex(int a,int b){ real=a; hypo=b; value=a*a+b*b; } bool operator< (complex y) const{ return value<y.value; } }; priority_queue<complex> q; void init(){ while(!q.empty()) q.pop(); } void getnum(string x,int& a,int& b){ int one=x.find('+'); int two=x.find('i'); a=0; for(int i=0;i<one;i++){ a=a*10+x[i]-'0'; } b=0; for(int i=two+1;i<x.length();i++){ b=b*10+x[i]-'0'; } } int main() { int n; while(cin>>n){ init(); for(int i=0;i<n;i++){ string x; cin>>x; if(x=="Pop"){ if(q.empty()) cout<<"empty"<<endl; else{ complex t=q.top(); cout<<t.real<<"+i"<<t.hypo<<endl; q.pop(); cout<<"SIZE = "<<q.size()<<endl; } } else if(x=="Insert"){ string in; cin>>in; int a,b; getnum(in,a,b); q.push(complex(a,b)); cout<<"SIZE = "<<q.size()<<endl; } else; } } }