```cpp
#include<bits/stdc++.h>
using namespace std;
int n,m;
struct cmp{
bool operator()(int x,int y){
return x>y;
}
};
set<int> s;
priority_queue<int,vector<int>,cmp> q;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
int cnt=0;
for(int i=1;i<=m;i++){
int op;
cin>>op;
if(op==1){
cnt++;
q.push(cnt);
}
if(op==2){
int x;
cin>>x;
s.insert(x);
}
if(op==3){
while(s.find(q.top())!=s.end())q.pop();
cout<<q.top()<<endl;
}
}
return 0;
}
```
by BGM114514 @ 2024-04-14 17:23:41
@[abcdefghik](/user/1117637)
by BGM114514 @ 2024-04-14 17:24:02
@[BGM114514](/user/705058) 收到
by abcdefghik @ 2024-04-14 17:29:32