A sequence is called -Bonnaci if it is calculated from its previous elements. An XOR -Bonacci sequence can be formulated in the following format:
Here denotes bitwise XOR operation. Newbies jury have recently found an interesting sequence which is obtained from the XOR operation on the first elements of the XOR -Bonacci sequence:
It can be proven that for calculating all of the -Bonacci Numbers, only the first elements are need to be known. Given the first numbers of the XOR -Bonacci sequence, your task is to calculate for queries.
The first line of the input contains two space separated integers . The second line contains space separated integers denoting respectively. Each of the next lines, describes a query by giving an integer .
For each query, you should print the in a line.