#include #include using namespace std; struct node { node(int a,int b):num(a),p(b){} int num; int p; bool operator < (const node a)const { return p s; while(cin>>com&&com) { switch(com) { case 1: { cin>>k>>p; s.insert(node(k,p)); }break; case 2: { if(s.empty()) cout<<0<