#P7811. Boring Game

Boring Game

Boring Game

Problem Description

Given nn sheets of paper, place them on the table in pile and fold them in half kk times from left to right. Now from top to bottom, mark a number on paper at each side of the front and back. So there are 2×n×2k2 \times n \times 2^k numbers in total and these numbers form a permutation PP. Now it expands to its original. These numbers from top to bottom, from front to back, from left to right form a permutation QQ. Given the permutation PP, find the permutation QQ. See example for details. For k=1k=1 and P=1..4×nP=1..4 \times n, you can assume that you are marking the page numbers before printing a booklet forming from nn pieces of A4A4 papers.

Input

The first line contains a single integer T(1T30)T(1 \leq T \leq 30) , the number of test cases. For each test case, the first line gives two integers nn, kk(1n200,1k101 \leq n \leq 200, 1 \leq k \leq 10). The next line gives the permutation PP that consists of 2×n×2k2 \times n \times 2^k integers pi(1pi2×n×2k)p_i(1 \leq p_i \leq 2 \times n \times 2^k). It is guaranteed that 2×n×2k \sum 2 \times n \times 2^k doesn't exceed 10610^6.

Output

The output should contain TT lines each containing 2×n×2k2 \times n \times 2^k integers separated by spaces, indicating the permutation QQ.

Sample Input

1
2 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Sample Output

12 5 4 13 11 6 3 14 10 7 2 15 9 8 1 16
[hint]
[center][img]../../data/images/C883-1003-1.png[/img][/center]
[\hint]

Source

2020 Multi-University Training Contest 5