| Introductory Problems: XOR Basis |
|---|
| Finished |
You are given an empty sequence $$$a$$$. Your task is to process $$$q$$$ queries of the following types:
1. Append $$$x$$$ to the end of sequence $$$a$$$;
2. Among all distinct numbers you can produce by choosing any subsequence(possibly empty) from $$$a$$$ and calculating their bitwise XOR, print the $$$k$$$-th smallest one. If such a number does not exist, print $$$-1$$$ instead.
The first line of input contains a single integer $$$q \ (1 \le q \le 2 \times 10^5)$$$.
Then, there are $$$q$$$ lines describing the queries. Each line has two integers: $$$1\ x \ (0 \le x \lt 2^{60})$$$ or $$$2\ k \ (1 \le k \le 2^{60})$$$
For each query of type 2, print a line of a single integer denoting the answer.
7 1 5 1 6 2 1 2 2 2 3 2 4 2 5
0 3 5 6 -1
3 1 1000 1 1000 2 3
-1
| Name |
|---|


