import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        ArrayList<int[]> arrayList = new ArrayList<>(a);
        int[] k = new int[a];
        for (int j = 0; j < a; j++) {
            int n = in.nextInt();
            int[] arr = new int[2 * n];
            k[j] = in.nextInt();
            for (int i = 0; i < arr.length; i++) {
                arr[i] = in.nextInt();
            }
            arrayList.add(arr);
        }
        ArrayList<int[]> arr = new ArrayList<>(a);
        for (int i = 0; i < a; i++) {
            arr.add(change(arrayList.get(i), k[i]));
        }
        for (int i = 0; i < a; i++) {
            for (int j = 0; j < arr.get(i).length; j++) {
                System.out.print(arr.get(i)[j] + " ");
            }
            System.out.println();
        }
    }
    public static int[] change(int[] arr, int k) {
        if (k == 0)
            return arr;
        int n = arr.length >> 1;
        int[] array = new int[arr.length];
        for (int i = 0; i < arr.length; i += 2) {
            array[i] = arr[(i + 1) / 2];
            array[i + 1] = arr[n + i / 2];
        }
        return change(array, k - 1);
    }
}