//一道大水题,优先队列的基本用法
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
int n, m, k, T;
priority_queue<int, vector<int>, greater<int>> pq;
void solve() {
int op;
cin >> op;
if (op == 1) {
int x;
cin >> x;
pq.push(x);
} else if (op == 2) {
cout << pq.top() << endl;
} else if (op == 3) {
if (!pq.empty()) {//删除元素的时候一定要判空,养成习惯
pq.pop();
}
}
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> T;
while (T--)solve();
return 0;
}

京公网安备 11010502036488号