- Time limit: 2.00 s
- Memory limit: 512 MB
Uolevi is creating a list of numbers. He is particularly interested in bitwise XORs of the numbers in his list. Sometimes Uolevi wonders if it is possible to form a given number as a bitwise XOR of one or more numbers in his list.
To help Uolevi, implement a data structure that maintains a list of numbers and supports the following operations:
- Add a number to the list
- Determine if it is possible to select one or more numbers in the list such that the bitwise XOR of the numbers is equal to a given number
Initially the list is empty.
Input
The first line contains an integer q, the number of queries. Next q lines each contain two integers t_i and x_i where t_i is the type of the query. If the type is 1, you should add x_i to the list. If the type is 2 you should determine if it is possible to form x_i.
Output
For each query of type 2, output YES
if it is possible to select one or more numbers in the list whose bitwise XOR is equal to x_i, and otherwise output NO
.
Constraints
- 1 \le q \le 5 \cdot 10^5
- 0 \le x_i < 2^{20}
Example
Input:
6 1 1 1 2 1 4 2 5 2 7 2 0
Output:
YES YES NO
Input:
5 2 5 1 3 2 1 1 6 2 5
Output:
NO NO YES