#include<bits/stdc++.h>
using namespace std;
int n,tot,op;
vector <int>num;
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>op;
if(op==1){
cin>>tot;
num.push_back(tot);
make_heap(num.begin(),num.end(),greater<int>());
}
if(op==2){
cout<<num[0]<<endl;
}
if(op==3){
pop_heap(num.begin(),num.end(),greater<int>());
num.pop_back();
}
}
return 0;
}
原谅我没有缩进,要不然放不下