power-house-2-1
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Gazu succeeded in finding the correct the bulb positions in “Power House” now he is with the teacher. When the field trip got over teacher gathered all the students in the hall and was about to leave when she found the one and only exit door of the power house was sealed shut. Adjacent to the door there was a 8192x8192 grid of ON-OFF switches with a audio tape labelled as ‘play me’. They played that tape and the message in it was

‘Hello my students I am curator of the power house and I want to play a game, in front of you there is a grid of switches labelled from 0 to (81928192)-1, there is a special switch in this grid which when toggled will open the seal of the exit door. Behind the board there is an envelope hidden, inside it index of the special switch is written. Rules of my game are, you have to divide yourself into two groups, only first group will open the envelope and is allowed to toggle any 1 switch from the grid. Second group can not see first group during this time. Now the second group students will come and will deduce index of the special switch from the resulting grid. If the second group toggles the wrong switch, the seal will become permanent and this house will become your tomb. Remember I am watching you. Make your choice’*

Gazu helped students to solve this problem, he made a solution. The students then got divided and Gazu was in group 1 after their job was over. Group 2 students came but unfortunately all of them forgot the solution only thing they remember was ‘choose OFF state’. So all the group 2 asks you for help. 

Input
First line contains number of testcases 1<T<100, for each testcase you will be given index of the switches which were in OFF state after group 1 completed their job. These indices are space separated and terminated by -1

Output
One line containing the index of the special switch.

SAMPLE INPUT
3
3 7 20 37 61 -1
6 9 69 -1
5 23 54 81 90 -1

SAMPLE OUTPUT
8
74
47