Luv karakoti, One of the biggest Zehri of NIT kkr was once playing with XOR. Harsh bored with his zehar gave him a task so that luv is not able to crack a zehar for some time. But i do love his zehar alot :P, please finish this task for him asap so that he's back to his old same zehar.
Task is very simple, You are given 2 integes, N and K. N is number of elements in an array and K is number of cycles. In each cycle you have to replace each element with xor of (previous element, current element, next element).
For first element of an array, previous element is last element of array and vice-verse.
Cycle should start from the first element.
you need to print array after application of K cycles.
XOR operation is applied one by one of each element. i.e previous modified element is used for replacing the current element (NA on first element as its previous element is modified at last). See testcase explanation for clarity.
INPUT
First line contains T,number of test cases, each test case consist of 2 numbers, N and K, representing number of elements in an array and number of cycles. Next line contains N elements of array.
OUTPUT
N elements of array printed for each test case.
CONSTRAINTS:
1<=t<=10000
3<=N<=10000
1<=k<= 10^9
our array is 1 2 3 4 for first element 1 , prev element is 4 and next is 2 so we replace index 1 with (1^2^4) 7 2 3 4 for index 2, (arr[1]^arr[2]^arr[3]) --> (7^2^3) 7 6 3 4 for index 3, ( arr[2]^arr[3]^arr[4]) --> (6^3^4) 7 6 1 4 for index 4 , ( arr[3]^arr[4]^arr[1]) --> (1^4^7) 7 6 1 2 so after 1 cycle array is 7 6 1 2 we repeat this again and get result 3 4 7 6