#ifdef MY_LOCAL #include "D://competitive_programming/debug/debug.h" #define debug(x) cerr << "[" << #x<< "]:"< #include #include using namespace __gnu_pbds; using namespace std; typedef long long ll; #define int ll typedef vector vi; typedef vector vvi; typedef pair ii; typedef vector vii; typedef vector vvii; typedef double ld; typedef tree, rb_tree_tag, tree_order_statistics_node_update> ost; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int q;cin>>q; set ss; vi curct(30, 0); REP(i, q) { int ty;cin>>ty; if (ty == 3) { if (ss.empty()) { cout<<-1<<"\n"; } else { int curans = 0; REP(j, 30) { if (curct[j] == (int)ss.size()) { curans += (1LL<>x; if (ss.find(x) == ss.end()) continue; ss.erase(x); REP(j, 30 ){ if ((1LL<>x; if (ss.find(x) != ss.end()) continue; ss.insert(x); REP(j, 30 ){ if ((1LL<