#include <iostream> #include <queue> using namespace std; struct Cx{ int a, b; bool operator< (const Cx& C) const{ int s1 = a * a + b * b, s2 = C.a * C.a + C.b * C.b; if(s1 != s2) return s1 < s2; return b > C.b; } }; priority_queue<Cx> q; int main(){ int n; string op; while(cin>>n){ while(n--){ cin>>op; if(op == "Pop"){ if(!q.size()) puts("empty"); else{ auto t = q.top(); q.pop(); printf("%d+i%d\n", t.a, t.b); printf("SIZE = %d\n", q.size()); } }else{ int x, y; scanf("%d+i%d", &x, &y); q.push({x, y}); printf("SIZE = %d\n", q.size()); } } } return 0; }