Devendra loves the XOR operation very much which is denoted by sign in most of the programming languages. He has a list of numbers and he wants to know the answers of queries. Each query will be denoted by three numbers i.e. .
For query , he has to print the value of the which can be described as given below. As the value of the can be large. So, print it modulus .
The first line contains an integer , i.e., the number of the elements in the list. List is numbered from to .
Next line will contain space seperated integers.
Third line will contain a number i.e. number of queries followed by lines each containing integers .
Print lines, line will be answer of query. Answer will be 0 in case of P=R.