Running Median#2443

Running Median

1 second
122.174 megabytes
Very easy

For this problem, you will write a program that reads a sequence of -bit signed integers. After each odd-indexed value is read, output the median (middle value) of the elements received so far.

Input

The first line contains the number (1 \leq p \leq 1000) of data sets that follow. The first line of each data set contains the data set number, followed by a space, followed by an odd decimal integer (1 \leq m \leq 9999), giving the total number of signed integers to be processed. The remaining line(s) in the dataset consist of the values, per line, separated by a single space. The last line in the dataset may contain fewer than values.

Output

For each data set, the first line of output contains the data set number, a single space, and the number of medians output (which should be one-half the number of input values plus one). The output medians will be on the following lines, per line, separated by a single space. The last line may have fewer than elements, but at least element. There should be no blank lines in the output.

Examples

Example 1

Loading
Loading