AND Rounds#4080

AND Rounds

2 seconds
128 megabytes
Very easy

You are given a cyclic array A containing numbers. In an AND round, each element of the array A is replaced by the bitwise AND of itself, the previous element, and the next element in the array. All operations take place simultaneously. Can you calculate the contents of array A after such AND rounds?

Input

The first line contains the number of test cases . The following lines describe the test cases, two lines per test case.

The first line contains two space-separated integers (3 \leq n \leq 20000) and (1 \leq k \leq 10^9).

The second line contains space-separated integers A_1, A_2, \ldots, A_n (0 \leq A_i \leq 10^9), the initial values of array A.

Output

For each test case, output one line containing integers: the contents of array A after AND rounds.

Examples

Example 1

Loading
Loading