#include #include #include #include #include #include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(int)(n); i++) const i64 INF = 1001001001001001001; using Modint = atcoder::static_modint<998244353>; int main(){ int Q; cin >> Q; set S; vector C(30); rep(i,Q){ int t; cin >> t; if(t == 1){ int x; cin >> x; if(S.count(x)) continue; S.insert(x); rep(j,30) C[j] += 1 - (x >> j & 1); } if(t == 2){ int x; cin >> x; if(!S.count(x)) continue; S.erase(x); rep(j,30) C[j] -= 1 - (x >> j & 1); } if(t == 3){ if(S.empty()){ cout << "-1\n"; continue; } int ans = 0; rep(j, 30) ans |= (C[j] ? 0 : 1) << j; cout << ans << '\n'; } } } struct ios_do_not_sync{ ios_do_not_sync(){ ios::sync_with_stdio(false); cin.tie(nullptr); } } ios_do_not_sync_instance;