def solve(q, qu): s = set() X = [] bit = [0] * 30 for v in qu: t = v[0] if t == 1: x = v[1] if x not in s: s.add(x) for i in range(30): if 1 & (x >> i): bit[i] += 1 elif t == 2: x = v[1] if x in s: s.discard(x) for i in range(30): if 1 & (x >> i): bit[i] -= 1 else: ans = 0 for i in range(30): if bit[i] == len(s) > 0: ans += 2 ** i X.append(ans) return X q = int(input()) qu = [list(map(int,input().split())) for _ in range(q)] for v in solve(q, qu): print(v)