#P7510. [2017年杭电多校]Just do it
[2017年杭电多校]Just do it
Just do it
Problem Description
There is a nonnegative integer sequence of length . HazelFan wants to do a type of transformation called prefix-XOR, which means changes into , where equals to the XOR value of . He will repeat it for times, please tell him the final sequence.
Input
The first line contains a positive integer , denoting the number of test cases. For each test case: The first line contains two positive integers . The second line contains nonnegative integers .
Output
For each test case: A single line contains nonnegative integers, denoting the final sequence.
Sample Input
2
1 1
1
3 3
1 2 3
Sample Output
1
1 3 1
Source
2017 Multi-University Training Contest - Team 7