Magic Potion 的具体编写

Problem Description
In a distant magic world, there is a powerful magician aswmtjdsj. One day,aswmtjdsj decide to teach his prentice ykwd to make some magic potions. The magic potion is made by 8 kinds of materials, what aswmtjdsj need to do is to tell ykwd how many each kind of materials is required. In order to prevent others from stealing these formulas, he decide to encrypt the formula. Assuming the amount of the eight kinds of materials are x1, x2, ... x8, aswmtjdsj will use a number m to encrypt, and finally tell ykwd nine numbers:x1 xor m, x2 xor m ,...., x8 xor m, (x1 + x2 +...+ x8) xor m . ykwd is too lazy,however,to calculate the value of the number m, so he asks you to help him to find the number m.

The first line is an integer t, the number of test cases.
Each of the next t lines contains 9 integers, respectively, x1 xor m, x2 xor m ,...., x8 xor m, (x1 + x2 +...+ x8) xor m, each of the 9 numbers is less or equal to 231-1.

For each test case you should output the value of m in a single line, you can assume that 0 <= m <= 231-1.

Sample Input
1 2 3 4 5 6 7 8 36
5 5 5 5 5 5 5 5 123

Sample Output

Csdn user default icon