#abc308g. [abc308_g]Minimum Xor Pair Query
[abc308_g]Minimum Xor Pair Query
Problem Statement
There is a blackboard on which you can write integers. Initially, no integer is written on the blackboard. Given queries, process them in order.
The query is of one of the following three kinds:
-
1 x
: write an on the blackboard. -
2 x
: erase an from the blackboard. At the point this query is given, it is guaranteed that at least one is written on the blackboard. -
3
: print the minimum possible bitwise XOR of two of the integers written on the blackboard. At the point this query is processed, it is guaranteed that at least two integers are written on the blackboard.
What is bitwise XOR? The bitwise XOR of non-negative integers and , , is defined as follows.
- When is written in binary, the s place () is if exactly one of the s places of and is , and otherwise.
For instance, (in binary: ).
Constraints
- When a query is given, at least one is written on the blackboard.
- When a query is given, at least two integers are written on the blackboard.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
In the -th query, , the kind of query, (one of , , or ), is first given. If or , an integer is additionally given.
In other words, each query is in one of the following three formats.
Output
Print lines, where is the number of queries such that .
The -th line should contain the answer to the -th such query.
Sample Input 1
9
1 2
1 10
3
1 3
3
2 2
3
1 10
3
Sample Output 1
8
1
9
0
After processing the -st query, a is written on the blackboard.
After processing the -nd query, a and a are written on the blackboard.
When processing the -rd query, the minimum possible bitwise XOR of two of the integers written on the backboard is .
After processing the -th query, a , a , and a are written on the blackboard.
When processing the -th query, the minimum possible bitwise XOR of two of the integers written on the backboard is .
After processing the -th query, a and a are written on the blackboard.
When processing the -th query, the minimum possible bitwise XOR of two of the integers written on the backboard is .
After processing the -th query, a and two s are written on the blackboard.
When processing the -th query, the minimum possible bitwise XOR of two of the integers written on the backboard is .