import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void playCard(int[] cards,int n,int k){
        for (int i = 0; i < k; i++) {
            int[] newCards=new int[cards.length];
            for (int j = 0; j < n; j++) {
                newCards[2*j]=cards[j];
                newCards[2*j+1]=cards[j+n];
            }
            cards=newCards;
        }
        printCard(cards);
    }
    public static void printCard(int[] cards){
        for (int i = 0; i < cards.length-1; i++) {
            System.out.print(cards[i]+" ");
        }
        System.out.println(cards[cards.length-1]);
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int groups=sc.nextInt();
        for (int i = 0; i < groups; i++) {
            int n=sc.nextInt();
            int k=sc.nextInt();
            int[] cards=new int[2*n];
            for (int j = 0; j < 2*n; j++) {
                cards[j]=sc.nextInt();
            }
            playCard(cards,n,k);
        }
    }
}