#include <bits/stdc++.h>
#include <queue>
using ll = long long;
using namespace std;
int main()
{
ll n;
cin>>n;
priority_queue<ll,vector<ll>,greater<ll>>q;
while(n--)
{
int x;
cin>>x;
if(x==1){
int pos;
cin>>pos;
q.push(pos);
}
else if(x==2){
cout<<q.top()<<endl;
}
else {
q.pop();
}
}
return 0;
}

京公网安备 11010502036488号