def main() :
	n = raw_input()
	n = [int(i) for i in n.split(" ")]
	total = n.pop(0)
	n.sort()
	total = total -1
	group = []
	for i in range(len(n)/2):
		group.append(n[i]+n[total])
		total =  total -1
	return max(group) - min(group)
	
	
	
	

t = raw_input()
response = []
for i in range(int(t)):
	response.append(main())
for n in response:
	print n
Language: Python