Jon Snow and his array

All submissions for this problem are available.
Jon Snow, the Lord Commander of Knights' Watch was bored in the Castle Black. He and Sam Tarly were sitting in a room. Sam Tarly, who knows logical operators (well, because he read many books) gave Jon Snow an array A_{i} and asked him to perform below task:
 Find the values by XORing the contiguous subarrays of array A
 XOR again, on the values obtained in step 1.
For example, if Ai = {1,2,3} then
subarrays for {1,2,3} are {1, 2, 3, (1, 2), (2, 3), (1, 3) and (1, 2, 3)}.Therefore, Answer will be 1 ⊕ 2 ⊕ 3 ⊕ (1 ⊕ 2) ⊕ (2 ⊕ 3) ⊕ (1 ⊕ 2 ⊕ 3) = 2 .
Jon Snow trusts you more than anyone, and he needs you to solve this problem (well, because Jon Snow knows nothing!).
Note : {1,7,8} is contiguous subarray of {1,7,8,9} and {1,8,9} is NOT a contiguous subarray of {1,7,8,9}
Input
First line contains an integer T, number of the test cases. The first line of each test case contains an integer N, number of elements in the array. The second line of each test case contains N integers that are elements of the array.
Tips: If you have multiple test cases in a file start this section as: "The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows."
 Don't write any constraints here, use section "Constraints" for this below.
 If for example the input of each test is an array you could write it like this: "The first line of each test case contains a single integer N denoting the number of .... The second line contains N spaceseparated integers A_{1}, A_{2}, ..., A_{N} denoting the ...".
 If you have multiple test cases in a file start this section as: "The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows."
 Don't write any constraints here, use section "Constraints" for this below.
 If for example the input of each test is an array you could write it like this: "The first line of each test case contains a single integer N denoting the number of .... The second line contains N spaceseparated integers A_{1}, A_{2}, ..., A_{N} denoting the ...".
Output
For each test case print the answer in a separate line.
Tips: If you have multiple test cases in a file start this section as: "For each test case, output a single line containing...".
 If you have multiple test cases in a file start this section as: "For each test case, output a single line containing...".
Constraints
 1 ≤ T ≤ 5
 2 ≤ N ≤ 10^{5}
 1 ≤ A_{i} ≤ 10^{8}
Example
Input: 2 3 1 2 3 4 4 5 7 5 Output: 2 0
Explanation
Example case 1. Already explained in problem statement.
Author:  shyamsingh8 
Tags  shyamsingh8 
Date Added:  7032016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 