// Arup Guha
// 1/16/2013
// Solution to 2009 Greater NY Regional Problem D: Running Median

import java.util.*;

public class d {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		for (int loop=1; loop<=numCases; loop++) {

			int dummy = stdin.nextInt();

			int n = stdin.nextInt();
			pair[] list = new pair[n];

			// Read in the data.
			for (int i=0; i<n; i++) {
				int val = stdin.nextInt();
				list[i] = new pair(i, val);
			}

			// First line of output for each case.
			System.out.println(loop+" "+((n+1)/2));

			// Solve the problem.
			solve(list);
		}

	}

	public static void solve(pair[] list) {

		// Set up useful variables.
		int n = list.length;
		int m = (n+1)/2;

		// Create sorted list.
		pair[] sort = new pair[n];
		for (int i=0; i<n; i++)
			sort[i] = list[i];
		Arrays.sort(sort);

		// We will store our medians here.
		int[] medians = new int[m];
		int ptr = m-1;

		// Fill in running medians, backwards.
		for (int i=m-1, j=n-1; true; i--,j-=2) {

			//System.out.println("i = "+i+" j = "+j);

			// Put in this median.
			medians[i] = sort[ptr].value;

			if (i==0) break;

			// Determine where the last two values are.
			int lowcnt = 0;
			if (list[j].compareTo(sort[ptr]) < 0) lowcnt++;
			if (list[j-1].compareTo(sort[ptr]) < 0) lowcnt++;

			// Take these out of the list.
			list[j].off();
			list[j-1].off();

			// Adjust our median location, if necessary.
			if (lowcnt == 0) {
				ptr--;
				while (!sort[ptr].in) ptr--;
			}
			else if (lowcnt == 2 || !sort[ptr].in) {
				ptr++;
				while (!sort[ptr].in) ptr++;
			}
		}

		for (int i=0; i<m; i++) {
			if (i%10 == 0 && i > 0)
				System.out.println();
			if (i%10 != 0)
				System.out.print(" ");
			System.out.print(medians[i]);
		}
		System.out.println();

	}
}

class pair implements Comparable<pair> {

	public int position;
	public int value;
	public boolean in;

	public pair(int pos, int v) {
		position = pos;
		value = v;
		in = true;
	}

	public int compareTo(pair other) {
		return this.value - other.value;
	}

	public void off() {
		in = false;
	}

}