#include<bits/stdc++.h>
#include <ostream>
#include <queue>
using namespace std;
priority_queue<string,vector<string>,greater<string> >S;int n,op;
int main(){
cin>>n;
for (int i=0; i<n;++i) {
cin>>op;
if (op==1) {
string s;
cin>>s;
S.push(s);
}else if (op==2) {
cout<<S.top()<<endl;
}else if (op==3) {
S.pop();
}else {
cout<<"程序错误1"<<endl;
}
}
return 0;
}

京公网安备 11010502036488号