sureshs-array-3

Suresh is a strange boy. He neither likes an array in ascending order nor in descending order. Then what does he like?
He likes an array if and only if it is mixed i.e, both ascending and descending. He has got lots of arrays from his friends. But he doesn't like any of them. Now he plans to re-construct those arrays :
He takes an array :
1. finds the smallest and largest integers among them
2.places the smallest followed by the largest number.
3.In a similar manner, he finds smallest and largest numbers among the remaining numbers and places them next to the previous numbers until all the numbers are over .

Input format:
T , the number of test cases

N , the number of elements in th array

A , the array

Output format:
Output the array 

SAMPLE INPUT
3
9
6 8 3 9 9 2 6 8 1 
3
3 8 2 
8
3 5 1 3 0 4 7 3

SAMPLE OUTPUT
1 9 2 9 3 8 6 8 6 
2 8 3 
0 7 1 5 3 4 3 3

Explanation

In test case 1: The array is  6 8 3 9 9 2 6 8 1 . Here the smallest and the largest number in the array are 1 and 9 respectively.
Now the newly formed array is  1 9
Remaining elements in the array are 6 8 3 9 2 6 8 . Here the smallest and largest elements among the remaining elements are 2 and 9 respectively.
Now the array is 1 9 2 9
In the same way, from the remaining 6 8 3 6 8 we have 3 as smallest and 8 as largest.
Now the array is 1 9 2 9 3 8
Similarly we arrive at the array  1 9 2 9 3 8 6 8 6

Source: hackerearth | Difficulty: EASY


Solutions:
for i in range(int(input())):
	num = int(input())
	arr = input().split()
	for j in range(num):
		arr[j] = int(arr[j])
	st = ""
	count = 0
	while(len(arr) >= 1):
		if(count%2 == 0):
			x = min(arr)
			st += str(x) + " "
			arr.remove(x)
			count += 1
		else:
			y = max(arr)
			st += str(y) + " "
			arr.remove(y)
			count += 1
	print(st)
		


for i in range(int(input())):
	num = int(input())
	arr = input().split()
	for j in range(num):
		arr[j] = int(arr[j])
	st = ""
	count = 0
	while(len(arr) >= 1):
		if(count%2 == 0):
			x = min(arr)
			st += str(x) + " "
			arr.remove(x)
			count += 1
		else:
			y = max(arr)
			st += str(y) + " "
			arr.remove(y)
			count += 1
	print(st)
		


for i in range(int(input())):
	num = int(input())
	arr = input().split()
	for j in range(num):
		arr[j] = int(arr[j])
	st = ""
	count = 0
	while(len(arr) >= 1):
		if(count%2 == 0):
			x = min(arr)
			st += str(x) + " "
			arr.remove(x)
			count += 1
		else:
			y = max(arr)
			st += str(y) + " "
			arr.remove(y)
			count += 1
	print(st)