Reminder: the median of the array $[a_1, a_2, \dots, a_{2k+1}]$ of odd number of elements is defined as follows: let $[b_1, b_2, \dots, b_{2k+1}]$ be the elements of the array in the sorted order. Then median of this array is equal to $b_{k+1}$.

There are $2n$ students, the $i$-th student has skill level $a_i$. It's not guaranteed that all skill levels are distinct.

Let's define skill level of a class as the median of skill levels of students of the class.

As a principal of the school, you would like to assign each student to one of the $2$ classes such that each class has odd number of students (not divisible by $2$). The number of students in the classes may be equal or different, by your choice. Every student has to be assigned to exactly one class. Among such partitions, you want to choose one in which the absolute difference between skill levels of the classes is minimized.

What is the minimum possible absolute difference you can achieve?


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^5$) — the number of students halved.

The second line of each test case contains $2n$ integers $a_1, a_2, \dots, a_{2 n}$ ($1 \le a_i \le 10^9$) — skill levels of students.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.


-----Output-----

For each test case, output a single integer, the minimum possible absolute difference between skill levels of two classes of odd sizes.


-----Example-----
Input
3
1
1 1
3
6 5 4 1 2 3
5
13 4 20 13 2 5 8 3 17 16

Output
0
1
5



-----Note-----

In the first test, there is only one way to partition students — one in each class. The absolute difference of the skill levels will be $|1 - 1| = 0$.

In the second test, one of the possible partitions is to make the first class of students with skill levels $[6, 4, 2]$, so that the skill level of the first class will be $4$, and second with $[5, 1, 3]$, so that the skill level of the second class will be $3$. Absolute difference will be $|4 - 3| = 1$.

Note that you can't assign like $[2, 3]$, $[6, 5, 4, 1]$ or $[]$, $[6, 5, 4, 1, 2, 3]$ because classes have even number of students.

$[2]$, $[1, 3, 4]$ is also not possible because students with skills $5$ and $6$ aren't assigned to a class.

In the third test you can assign the students in the following way: $[3, 4, 13, 13, 20], [2, 5, 8, 16, 17]$ or $[3, 8, 17], [2, 4, 5, 13, 13, 16, 20]$. Both divisions give minimal possible absolute difference.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation

Greedy algorithms


Solutions:
t = int(input())
while t != 0:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().strip().split()))[:2 * n]
	arr.sort()
	print(arr[n] - arr[n - 1])


for _ in range(int(input())):
	n = int(input())
	arr = sorted(map(int, input().split()))
	print(abs(arr[n] - arr[n - 1]))


for _ in range(int(input())):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	print(abs(l[n] - l[n - 1]))


import sys

def ints():
	return list(map(int, sys.stdin.readline().strip().split()))
tc = int(input())
while tc:
	tc -= 1
	n = int(input())
	n *= 2
	ls = ints()
	ls.sort()
	print(ls[n // 2] - ls[n // 2 - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[n] - a[n - 1]))


def process(A):
	n = len(A)
	A = sorted(A)
	if n == 2:
		return A[1] - A[0]
	a1 = A[n // 2 - 1]
	a2 = A[n // 2]
	return a2 - a1
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	print(process(A))


t = int(input())
while t:
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	print(abs(l[n - 1] - l[n]))
	t -= 1


import math
a = int(input())
for i in range(0, a):
	a = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[len(arr) // 2] - arr[len(arr) // 2 - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	a = list(map(int, input().split()))
	sorted_a = sorted(a)
	mid = len(a) // 2
	prev_mid = mid - 1
	print(sorted_a[mid] - sorted_a[prev_mid])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	a = int(input())
	mas = list(map(int, input().split()))
	mas = sorted(mas)
	print(mas[a] - mas[a - 1])


import math, collections, sys
input = sys.stdin.readline

def case():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])
for _ in range(int(input())):
	case()


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(j) for j in input().split()]
	l.sort()
	d = int(len(l))
	k = int(d / 2)
	print(abs(l[k] - l[k - 1]))


test = int(input())
for i in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = arr[n] - arr[n - 1]
	print(ans)


from sys import stdin, stdout
from os import path
if path.exists('inp.txt'):
	stdin = open('inp.txt', 'r')
q = int(stdin.readline())
for _ in range(q):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	(cnt, b, c) = (0, [], [])
	b.append(0)
	c.append(0)
	for i in a:
		cnt += 1
		if cnt % 2:
			b.append(i)
		else:
			c.append(i)
	if n % 2:
		print(abs(b[int(n / 2) + 1] - c[int(n / 2) + 1]))
	else:
		ans = int(1e+18)
		ans = min(abs(b[int(n / 2)] - c[int(n / 2) + 1]), ans)
		ans = min(abs(b[int(n / 2 + 1)] - c[int(n / 2)]), ans)
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().strip().split()]
	a.sort()
	print(a[n] - a[n - 1])


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	A = sorted(map(int, input().split()))
	print(A[N] - A[N - 1])


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
for i in range(get_int()):
	n = get_int()
	lst = sorted(get_int_list())
	i = n
	j = n + 1
	print(lst[j - 1] - lst[i - 1])


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	print(a[n] - a[n - 1])


n = int(input())
for i in range(n):
	m = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[m] - l[m - 1])


def main():
	from sys import stdin, stdout
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		arr.sort()
		stdout.write(str(abs(arr[N] - arr[N - 1])) + '\n')
main()


I = input
for _ in [0] * int(I()):
	n = int(I())
	a = sorted(map(int, I().split()))
	print(a[n] - a[n - 1])


tests = int(input())
for test in range(tests):
	size = int(input())
	skills = [int(s) for s in input().split()]
	skills.sort()
	print(skills[size] - skills[size - 1])


for v in range(int(input())):
	n = int(input())
	x = [int(q) for q in input().split()]
	j = n
	y = sorted(x)
	print(abs(y[j] - y[j - 1]))


testcases = int(input())
vals = []
while testcases:
	(_, values) = (input(), list(map(int, input().split())))
	vals.append(values)
	testcases -= 1
for i in vals:
	i.sort()
	n = len(i)
	print(abs(i[n // 2] - i[n // 2 - 1]))


queries = int(input())
for _ in range(queries):
	length = int(input())
	students = [int(value) for value in input().split()]
	students.sort()
	print(students[length] - students[length - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	y = list(map(int, input().split()))
	y = sorted(y)
	print(abs(y[n] - y[n - 1]))


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
t = getInt()
for i in range(t):
	n = getInt()
	a = getList()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
ans = []
for kek in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans.append(a[n] - a[n - 1])
print(*ans, sep='\n')


def med(arr):
	return arr[len(arr) >> 1]

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(b1, b2) = (list(), list())
	for i in range(n):
		b1.append(arr[2 * i])
		b2.append(arr[2 * i + 1])
	if n & 1:
		return abs(med(b1) - med(b2))
	b2.append(b1.pop())
	b2.sort()
	mi1 = abs(med(b1) - med(b2))
	b1.append(b2.pop())
	b1.append(b2.pop())
	b1.sort()
	mi2 = abs(med(b1) - med(b2))
	return min(mi2, mi1)
for _ in range(int(input())):
	print(solve())


def solve():
	n = int(input())
	a = input().split()
	for i in range(2 * n):
		a[i] = int(a[i])
	a.sort()
	print(a[n] - a[n - 1])
t = int(input())
while t != 0:
	t -= 1
	solve()


T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	A = list(map(int, input().split()))
	A.sort()
	print(abs(A[N] - A[N - 1]))


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	print(l1[n] - l1[n - 1])


for _ in range(int(input())):
	n = int(input())
	arr = [int(g) for g in input().split(' ')]
	sortedarr = sorted(arr)
	print(sortedarr[n] - sortedarr[n - 1])


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	li.sort()
	mina = []
	print(li[n] - li[n - 1])


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		print(a[n] - a[n - 1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	n = int(input())
	lista = input().split()
	for j in range(2 * n):
		lista[j] = int(lista[j])
	lista.sort()
	print(abs(lista[n - 1] - lista[n]))


import sys

class BAssigningToClasses:

	def solve(self):
		for _ in range(int(input())):
			n = int(input())
			a = [int(_) for _ in input().split()]
			a.sort()
			ans = float('inf')
			for i in range(2 * n - 1):
				if i == 2 * n - i - 2:
					ans = min(ans, abs(a[i] - a[i + 1]))
			print(ans)
solver = BAssigningToClasses()
input = sys.stdin.readline
solver.solve()


import sys

def main():
	for _ in range(int(sys.stdin.readline())):
		n = int(sys.stdin.readline())
		l = [int(x) for x in sys.stdin.readline().split()]
		l.sort()
		x = len(l) // 2
		print(abs(l[x] - l[x - 1]))
main()


t = int(input())
while t:
	n = int(input())
	a = [int(x) for x in input().split()]
	a = sorted(a)
	print(a[n] - a[n - 1])
	t -= 1


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
for _ in range(t()):
	n = t()
	l = list(ll())
	l.sort()
	m = l[n]
	print(abs(m - l[n - 1]))


for i in range(int(input())):
	a = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[2 * a // 2] - arr[2 * a // 2 - 1])


def solve(a, n):
	a.sort()
	ans = 1000000009
	for i in range(0, 2 * n):
		if i < n:
			ans = min(ans, a[n] - a[i])
		elif i > n:
			ans = min(ans, a[i] - a[2 * n - i])
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(a, n))


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	n = inp()
	a = inlt()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for j in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


class Solution:

	def median(self, nums):
		nums.sort()
		req = len(nums) // 2
		return abs(nums[req] - nums[req - 1])
for _ in range(int(input())):
	n = int(input())
	res = Solution().median(list(map(int, input().split())))
	print(res)


t = int(input())
for k in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	mas.sort()
	print(mas[n] - mas[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a = sorted(a)
	print(a[len(a) // 2] - a[len(a) // 2 - 1])


t = int(input())
for td in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	d = abs(a[n] - a[n - 1])
	print(d)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = len(a) // 2
	j = i - 1
	ans = abs(a[i] - a[j])
	print(ans)


num_cases = int(input())
for i in range(num_cases):
	num_elements = int(input()) * 2
	array = [int(n) for n in input().split()]
	array.sort()
	print(array[num_elements // 2] - array[num_elements // 2 - 1])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	arr = sorted(arr)
	print(abs(arr[n - 1] - arr[n]))


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = sorted(map(int, input().split()))
	print(A[n] - A[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [*map(int, input().split())]
	sa = sorted(a)
	l = []
	r = []
	for i in range(0, 2 * n - 1):
		l.append(sa[i])
		r.append(sa[i + 1])
	print(abs(l[n - 1] - r[n - 1]))


for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	ans = a[-1] - a[0]
	for i in range(n):
		x = n * 2 - (i * 2 + 1)
		y = x // 2
		ans = min(ans, a[i + y + 1] - a[i])
	print(ans)


from builtins import int
till = int(input())
for i in range(till):
	x = int(input())
	arr = [int(num) for num in input().split()]
	arr.sort()
	print(abs(arr[x - 1] - arr[x]))


n = int(input())
for i in range(n):
	p = int(input())
	q = list(map(int, input().split()))
	q.sort()
	print(abs(q[p - 1] - q[p]))


ans = []
for t in range(int(input())):
	n = int(input())
	nums = [int(i) for i in input().split()]
	nums.sort()
	ans.append(str(abs(nums[n] - nums[n - 1])))
print('\n'.join(ans))


from math import ceil, sqrt, floor
import sys
n = int(input())
for i in range(n):
	a = int(input())
	liste = sorted(list(map(int, input().split())))
	print(liste[a] - liste[a - 1])


t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	A.sort()
	print(A[n] - A[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	dif = a[n] - a[n - 1]
	print(dif)


def solve():
	n = int(input())
	levels = sorted(map(int, input().split()))
	print(levels[n] - levels[n - 1])
T = int(input())
for _ in range(T):
	solve()


numTests = int(input())
for _ in range(numTests):
	n = int(input())
	bucket1 = []
	bucket2 = []
	skill = list(map(int, input().split()))
	skill.sort()
	print(abs(skill[n] - skill[n - 1]))


t = int(input())
for tt in range(t):
	n = int(input())
	x = list(input().split())
	a = []
	for i in range(2 * n):
		a.append(int(x[i]))
	a.sort()
	c = abs(a[n - 1] - a[n])
	print(c)


for i in range(int(input())):
	(n, a) = (int(input()), sorted(map(int, input().split())))
	ans = float('inf')
	print(abs(a[n] - a[n - 1]))


t = int(input())
for i in range(t):
	n = int(input())
	lsr = list(map(int, input().strip().split()))[:2 * n]
	lsr.sort()
	print(lsr[n] - lsr[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	r = 2 * n
	l = list(map(int, input().split()))[:r]
	l.sort()
	l2 = l[r // 2:]
	l1 = l[:r // 2]
	x = max(l1)
	y = min(l2)
	print(abs(x - y))


def find_absme(n, a):
	a = sorted(a)
	return abs(a[n] - a[n - 1])
t = int(input())
ans = []
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans.append(find_absme(n, a))
for y in ans:
	print(y)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = sorted(map(int, input().split()))
	print(a[n] - a[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	n *= 2
	if n == 2:
		print(abs(a[-1] - a[0]))
	else:
		print(a[n // 2] - a[n // 2 - 1])


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def sieve(x):
	a = [True] * (x + 1)
	sq = floor(sqrt(x))
	for i in range(3, sq + 1, 2):
		if a[i]:
			for j in range(i * i, x + 1, i):
				a[j] = False
	if x > 1:
		p = [2]
	else:
		p = []
	for i in range(3, x + 1, 2):
		if a[i]:
			p.append(i)
	return p

def prime_factor(x):
	p = sieve(ceil(sqrt(x))) + [100000000]
	a = []
	i = 0
	while p[i] * p[i] <= x:
		if not x % p[i]:
			a.append(p[i])
			x //= p[i]
		else:
			i += 1
	if x > 1:
		a.append(x)
	return a
res = ['YES', 'NO']
for _ in range(ii()):
	n = ii()
	a = li()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	c = 0
	(a, b) = ([], [])
	for i in range(len(l)):
		if c % 2 == 0:
			a.append(l[i])
		else:
			b.append(l[i])
		c = c + 1
	if n % 2 == 0:
		q = b.pop(len(b) - 1)
		a.append(q)
	(x, y) = (len(a) // 2, len(b) // 2)
	p = abs(a[x] - b[y])
	print(p)
	t = t - 1


def f(a):
	a.sort()
	return abs(a[len(a) // 2] - a[len(a) // 2 - 1])
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(f(a))


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	ans = []
	for i in range(0, n + 1):
		ans.append(abs(lst[i] - lst[2 * n - i - 1]))
	print(min(ans))
t = int(input())
for i in range(t):
	solve()


test = int(input())
for t in range(test):
	n = int(input())
	l = [int(x) for x in input().split(' ')]
	l.sort()
	diff = l[n] - l[n - 1]
	print(diff)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[n] - arr[n - 1])


t = int(input())
l1 = []
for k in range(t):
	n = int(input())
	l2 = [int(a) for a in input().split()]
	l2.sort()
	l1.append(l2[n] - l2[n - 1])
for j in range(t):
	print(l1[j])


for i in range(int(input())):
	n = int(input())
	ls = [int(a) for a in input().split()]
	ls.sort()
	print(abs(ls[n] - ls[n - 1]))


for t in range(int(input())):
	n = int(input())
	a = [int(v) for v in input().split()]
	a.sort()
	print(abs(a[n] - a[n - 1]))


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	L.sort()
	print(L[N] - L[N - 1])


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	A.sort()
	ans = abs(A[N] - A[N - 1])
	print(ans)


for l in range(int(input(''))):
	n = int(input(''))
	z = list(map(int, input('').split(' ')))
	z.sort()
	minDif = z[len(z) - 1]
	for it in range(1, len(z)):
		if it + 1 - n - 1 >= 0:
			if z[it] - z[it - (it + 1 - n - 1) - 1] < minDif:
				minDif = z[it] - z[it - (it + 1 - n - 1) - 1]
	print(minDif)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()
from random import randint
from collections import defaultdict, deque

class Graph(object):

	def __init__(self, dic):
		self.dict = dic
		self.vertex = set()

	def addedge(self, a, b):
		if self.dict[a] == []:
			self.vertex.add(a)
		if b != None:
			self.dict[a].append(b)

	def con_com_util(self, i, unvisited, count, comp):
		for j in self.dict[i]:
			if j in unvisited:
				unvisited.remove(j)
				comp[count].append(j)
				comp = self.con_com_util(j, unvisited, count, comp)
		return comp

	def conn_components(self):
		unvisited = self.vertex.copy()
		count = 0
		comp = defaultdict(list)
		while unvisited:
			i = unvisited.pop()
			comp[count].append(i)
			comp = self.con_com_util(i, unvisited, count, comp)
			count += 1
		return (count, comp)

def countSetBits(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count
import random

def primesbelow(N):
	correction = N % 6 > 1
	N = {0: N, 1: N - 1, 2: N + 4, 3: N + 3, 4: N + 2, 5: N + 1}[N % 6]
	sieve = [True] * (N // 3)
	sieve[0] = False
	for i in range(int(N ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((N // 6 - k * k // 6 - 1) // k + 1)
			sieve[(k * k + 4 * k - 2 * k * (i % 2)) // 3::2 * k] = [False] * ((N // 6 - (k * k + 4 * k - 2 * k * (i % 2)) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, N // 3 - correction) if sieve[i]]

def solve():
	n = int(inp())
	ar = lis()
	ar.sort()
	print(ar[n] - ar[n - 1])
testcase(int(inp()))


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	print(lst[n] - lst[n - 1])


def solve():
	t = int(input())
	while t > 0:
		n = int(input())
		li = [int(i) for i in input().split()]
		li.sort()
		print(li[n] - li[n - 1])
		t -= 1
solve()


from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1
t = ii()
for _ in range(t):
	n = ii()
	l = sorted(li())
	print(l[n] - l[n - 1])


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	print(a[n] - a[n - 1])


t = int(input())
for loop in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[n] - arr[n - 1])


for i in range(int(input())):
	n = int(input())
	ar = sorted(map(int, input().split(' ')))
	print(ar[n] - ar[n - 1])


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)

def number_to_list(a):
	b = []
	while a >= 1:
		c = a % 10
		a = int(a / 10)
		b.append(c)
	return list(reversed(b))

def str_list_to_int_list(a):
	a = list(map(int, a))
	return a

def make_1d_array(n, inti=0):
	a = [inti for _ in range(n)]
	return a

def make_2d_array(n, m, inti=0):
	a = [[inti for _ in range(m)] for _ in range(n)]
	return a

def make_3d_array(n, m, k, inti=0):
	a = [[[inti for _ in range(k)] for _ in range(m)] for _ in range(n)]
	return a

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
(t,) = I()
for t1 in range(t):
	(n,) = I()
	a = sorted(I())
	min1 = 10 ** 10
	i = n - 1
	j = n
	min1 = min(min1, abs(a[i] - a[j]))
	print(min1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	a.sort(reverse=True)
	b = []
	c = []
	if n % 2 == 1:
		for i in range(0, len(a), 2):
			b.append(a[i])
			c.append(a[i + 1])
	else:
		for i in range(0, len(a), 2):
			b.append(a[i])
		b.append(a[n - 1])
		for i in range(1, len(a) - 1, 2):
			c.append(a[i])
	r1 = b[int(len(b) / 2)]
	r2 = c[int(len(c) / 2)]
	print(abs(r1 - r2))


from math import *
t = int(input())
m = []
n = []
for i in range(t):
	n.append(int(input()))
	x = list(map(int, input().split()))
	x.sort()
	m.append(x)
for i in range(t):
	print(m[i][n[i]] - m[i][n[i] - 1])


R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	arr = sorted(R())
	print(arr[n] - arr[n - 1])


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(abs(a[n] - a[n - 1]))


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	n = inp()
	a = inlt()
	a.sort()
	print(a[n] - a[n - 1])


def get_diff(b, c, l):
	popped = b.pop()
	index = len(c) - 1
	for i in range(index, -1, -1):
		if c[i] < popped:
			index = i
			break
	c.insert(index + 1, popped)
	return abs(b[(l - 1) // 2] - c[(l + 1) // 2])
t = int(input())
while t:
	n = int(input())
	a = sorted(list(map(int, input().split())))
	b = []
	c = []
	for (index, element) in enumerate(a):
		if index % 2:
			b.append(element)
		else:
			c.append(element)
	l = len(b)
	if l % 2:
		print(abs(b[l // 2] - c[l // 2]))
	else:
		diff1 = get_diff(b[:], c[:], l)
		diff2 = get_diff(c[:], b[:], l)
		print(min(diff1, diff2))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	n = 2 * n
	print(a[n // 2] - a[n // 2 - 1])


import os.path
import sys
from math import *
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def inp():
	return sys.stdin.readline().strip()
for _ in range(int(inp())):
	n = int(inp())
	arr = list(map(int, inp().split()))
	arr.sort()
	print(arr[n] - arr[n - 1])


def medi(lis, lenlis):
	return lis[lenlis - 1]
hm = int(input())
for i in range(hm):
	lenlis = int(input())
	lis = list(map(int, input().split()))
	sortedlis = sorted(lis)
	print(sortedlis[lenlis] - sortedlis[lenlis - 1])


def int_as_array(num):
	return list(map(int, [y for y in str(num)]))

def array_as_int(arr):
	return int(''.join(map(str, arr)))

def read_int_array():
	return list(map(int, input().split(' ')))

def read_int():
	return int(input())

def solve(array):
	mid = len(array) // 2
	return array[mid] - array[mid - 1]

def solve_v1(array):
	min_diff = None
	min_i = None
	print('array', array)
	for x in range(len(array) // 2):
		i = x * 2 + 1
		print('i', i)
		median1i = (i - 1) // 2
		median2i = i + (len(array) - i - 1) // 2
		median1 = array[median1i]
		median2 = array[median2i]
		diff = median2 - median1
		if min_i is None or diff < min_diff:
			print('median1, median2', median1, median2)
			min_i = i
			min_diff = diff
	return min_diff
T = int(input())
for i in range(T):
	n = read_int()
	array = read_int_array()
	s_array = sorted(array)
	print(solve(s_array))


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	print(abs(l[n - 1] - l[n]))


t = int(input())
for i in range(t):
	n = int(input())
	A = [int(i) for i in input().split()]
	A.sort()
	r = abs(A[n - 1] - A[n])
	print(r)


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	n = ii()
	l = sorted(il())
	print(l[n] - l[n - 1])


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
for i in range(ip()):
	n = ip()
	li = sorted(ai())
	print(li[n] - li[n - 1])


t = int(input())
while t != 0:
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	print(abs(arr[n] - arr[n - 1]))
	t -= 1


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n % 2 != 0:
		print(abs(a[n - 1] - a[n]))
	else:
		print(min(abs(a[n - 1] - a[n]), a[n + 1] - a[n - 2]))


t = int(input())
for T in range(t):
	N = int(input())
	li = list(map(int, input().strip().split()))[:2 * N]
	li.sort()
	print(li[N] - li[N - 1])


def solve(n, a):
	a.sort()
	return a[n] - a[n - 1]

def main():
	tc = int(input())
	for _ in range(tc):
		n = int(input())
		a = [int(x) for x in input().split()]
		print(solve(n, a))
main()


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	al = list(map(int, input().split()))
	al.sort()
	k = n
	print(al[k] - al[k - 1])

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
sizes = []
elements = []
val = 0
for i in range(t):
	sizes.append(int(input()))
	elements.append(input().split())
	for j in range(2 * sizes[i]):
		elements[i][j] = int(elements[i][j])
for i in range(t):
	elements[i].sort()
for i in range(t):
	n = sizes[i]
	val = int(elements[i][n]) - int(elements[i][n - 1])
	print(val)


for case in range(int(input())):
	n = int(input())
	series = [int(x) for x in input().split()]
	series.sort()
	l = n
	r = n + 1
	print(abs(series[n - 1] - series[n]))


t = int(input())
while t:
	n = int(input())
	a = input().split()
	for i in range(2 * n):
		a[i] = int(a[i])
	a.sort()
	print(a[n] - a[n - 1])
	t -= 1


for i in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	a = len(list1)
	list1.sort()
	print(abs(list1[a // 2 - 1] - list1[a // 2]))


def classass():
	tests = int(input())
	for i in range(tests):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		print(abs(arr[n - 1] - arr[n]))
		arr *= 0
classass()


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(min(a[n:]) - max(a[:n]))


T = int(input())
for _ in range(T):
	n = int(input())
	xs = sorted(map(int, input().split()))
	print(abs(xs[n] - xs[n - 1]))


for ts in range(int(input())):
	m = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	class1 = [arr[i] for i in range(0, len(arr), 2)]
	class2 = [arr[i] for i in range(1, len(arr), 2)]
	if m % 2 == 1:
		print(abs(class1[m // 2] - class2[m // 2]))
	else:
		class1.append(class2.pop())
		temp = abs(class1[len(class1) // 2] - class2[len(class2) // 2])
		class2.append(class1.pop())
		class2.append(class1.pop())
		print(min(temp, abs(class1[len(class1) // 2] - class2[len(class2) // 2])))


for i in range(int(input())):
	n = int(input())
	n = 2 * n
	arr = [int(i) for i in input().strip().split()]
	arr.sort()
	print(arr[n // 2] - arr[n // 2 - 1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	A = a[0:n]
	B = a[n:]
	print(B[0] - A[-1])


def solve(lst, n):
	lst.sort()
	ans = lst[n] - lst[n - 1]
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	lst = [int(x) for x in input().split()]
	print(solve(lst, n))


from sys import stdin, stdout
import traceback
read = stdin.readline
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	@classmethod
	def input(cls):
		s = cls()
		return s

	def solve(self):
		ret = 0
		n = int(read())
		an = reads()
		an = sorted(an)
		return an[n] - an[n - 1]
try:
	for _ in range(int(read())):
		writeln(Sol.input().solve())
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


from __future__ import division, print_function
import bisect
import math
import heapq
import itertools
import sys
from collections import deque
from atexit import register
from collections import Counter
from functools import reduce
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[2 * n // 2] - a[2 * n // 2 - 1]))


t = int(input())
for _ in range(t):
	n = int(input())
	n -= 1
	arr = [int(x) for x in input().split()]
	arr.sort()
	arr1 = arr[:n + 1]
	arr2 = arr[n + 1:]
	print(abs(arr1[-1] - arr2[0]))


n = int(input())
for i in range(n):
	t = int(input())
	l = list(map(int, input().split()))
	l.sort()
	n = len(l)
	t = l[n // 2] - l[n // 2 - 1]
	print(t)


import math
I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
t = I()
for i in range(t):
	n = I()
	a = IL()
	a.sort()
	c = a[n] - a[n - 1]
	print(c)


import sys
input = sys.stdin.readline
(K,) = map(int, input().split())
for _ in range(K):
	(N,) = map(int, input().split())
	xs = list(map(int, input().split()))
	xs = sorted(xs)
	print(xs[N] - xs[N - 1])


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(value) for value in input().split()]
	s.sort()
	print(abs(s[n - 1] - s[n]))


for tc in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	a.sort()
	ans = 10 ** 9 + 5
	print(abs(a[n] - a[n - 1]))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	print(abs(a[len(a) // 2] - a[len(a) // 2 - 1]))


cases = int(input())
for i in range(cases):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	print(abs(s[n] - s[n - 1]))


t = int(input())
for i in range(t):
	a = int(input())
	b = sorted(list(map(int, input().strip().split())))
	print(b[a] - b[a - 1])


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	a = I()
	n *= 2
	a.sort()
	print(abs(a[n // 2 - 1] - a[n // 2]))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	k = l[n - 1]
	m = l[n]
	print(m - k)


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	a = read()
	a.sort()
	print(abs(a[n - 1] - a[n]))


n = int(input())
for _ in range(n):
	num = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	(md1, md2) = (len(arr) // 2, len(arr) // 2 + 1)
	res = abs(arr[md1 - 1] - arr[md2 - 1])
	print(res)


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(abs(l[n] - l[n - 1]))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	print(abs(x[n] - x[n - 1]))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(abs(arr[n] - arr[n - 1]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	a.sort()
	print(a[n] - a[n - 1])


n = int(input())
Result = []
for i in range(0, n):
	len_ = int(input())
	List = list(map(int, input().strip().split()))[0:2 * len_]
	List.sort()
	Res = List[len_] - List[len_ - 1]
	Result.append(Res)
for i in Result:
	print(i)


import sys
for _ in range(int(input())):
	n = int(sys.stdin.readline().rstrip())
	num = list(map(int, sys.stdin.readline().split()))
	num.sort()
	print(num[n] - num[n - 1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(x, y) = ([], [])
	a.sort()
	print(a[n] - a[n - 1])


import bisect as bs
t = int(input())
for test in range(t):
	n = int(input())
	stds = [int(x) for x in input().split(' ')]
	stds.sort()
	diff = stds[n] - stds[n - 1]
	print(diff)


for _ in range(int(input())):
	n = int(input())
	x = sorted([int(n) for n in input().split()])
	print(x[n] - x[n - 1])


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	median = a[n] - a[n - 1]
	print(median)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	list1.sort()
	if n % 2 != 0:
		i = (n + 1) // 2 - 1
		r = i * 2
		s = 1 + i * 2
	else:
		s = n
		r = n - 1
	print(list1[s] - list1[r])
	t -= 1


n = int(input())
t = 1
while t <= n:
	no = int(input())
	arr = [int(k) for k in input().split()]
	arr.sort()
	print(arr[no] - arr[no - 1])
	t += 1


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


import sys
import math
import heapq
import bisect
import re
from collections import deque
from decimal import *
from fractions import gcd

def YES_NO(flag):
	if flag:
		print('AWW')
	else:
		print('WAW')

def main():
	n = int(sys.stdin.readline())
	q = [int(i) for i in sys.stdin.readline().split()]
	q.sort()
	res = 10000000000.0
	for i in range(n):
		res = min(res, abs(q[i] - q[n]))
	for i in range(n, 2 * n):
		res = min(res, abs(q[i] - q[n - 1]))
	print(res)
for i in range(int(sys.stdin.readline())):
	main()


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	A = list(map(int, input().split()))
	Query.append((N, A))
for (N, A) in Query:
	A.sort()
	ans = A[N] - A[N - 1]
	print(ans)


def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		aa.sort()
		print(aa[n] - aa[n - 1])
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = len(a) // 2
	c = b + 1
	print(a[c - 1] - a[b - 1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	x = len(l) // 2
	y = x - 1
	print(abs(l[x] - l[y]))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(abs(l[0] - l[1]))
		continue
	l.sort()
	print(l[n] - l[n - 1])


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	ara = inara()
	ara.sort()
	ans = ara[n] - ara[n - 1]
	print(ans)


from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
import sys
sys.setrecursionlimit(50000)
import collections
t = int(input())
for _ in range(t):
	n = int(input())
	As = list(map(int, input().split()))
	As.sort()
	print(abs(As[n - 1] - As[n]))


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
mo = 1000000007
for _ in range(int(input())):
	n = inn()
	a = arr()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
while t:
	n = int(input())
	skills = sorted(list(map(int, input().split(' '))))
	print(abs(skills[n - 1] - skills[n]))
	t -= 1


for i in range(int(input())):
	n = int(input())
	lst = sorted([int(x) for x in input().split()])
	print(lst[n] - lst[n - 1])


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	arr = input().split()
	for i in range(2 * n):
		arr[i] = int(arr[i])
	arr = sorted(arr)
	ans.append(arr[n] - arr[n - 1])
for i in range(t):
	print(ans[i])


q = int(input())
for _ in range(q):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	print(s[n] - s[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


x = int(input())
for i in range(x):
	m = int(input())
	arr = [int(new) for new in input().split()]
	arr.sort()
	print(abs(arr[m] - arr[m - 1]))


import collections
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	ar.sort()
	ans = print(abs(ar[n - 1] - ar[n]))


T = int(input())
for cs in range(T):
	n = int(input())
	a = sorted(map(int, input().split()))
	print(a[n] - a[n - 1])


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
from math import *

def ceil(a, b):
	if a % b == 0:
		return int(a / b)
	else:
		return a // b + 1
for i in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.sort()
	print(ar[n] - ar[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	a1 = []
	a2 = []
	for j in range(1, 2 * n, 2):
		a1.append(a[j - 1])
		a2.append(a[j])
	if n % 2 == 1:
		x = (n + 1) // 2 - 1
		s = abs(a1[x] - a2[x])
	else:
		x = a1[0]
		a1.remove(x)
		x = n // 2 - 1
		s = abs(a1[x] - a2[x])
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	print(abs(l[n - 1] - l[n]))


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l)
	po = len(l) // 2
	if n == 1:
		print(l[1] - l[0])
	else:
		print(abs(l[po] - l[po - 1]))


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	data.sort()
	a = data[n - 1] - data[n]
	a = abs(a)
	print(a)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	print(a[len(a) // 2] - a[len(a) // 2 - 1])

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


n = int(input())
l = []
for i in range(n):
	a = int(input())
	b = input().split()
	for j in range(2 * a):
		b[j] = int(b[j])
	b = sorted(b)
	l.append(b)
for i in range(n):
	print(abs(l[i][int(len(l[i]) / 2 - 1)] - l[i][int(len(l[i]) / 2)]))


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(a) == 2:
		print(abs(a[0] - a[1]))
	else:
		a.sort()
		print(abs(a[len(a) // 2 - 1] - a[len(a) // 2]))


num = int(input())
for _ in range(num):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	print(a[n - 1] - a[n])


t = int(input())

def f(l):
	ans = 0
	n = len(l)
	k = n // 2 + 1
	s = []
	for i in range(n):
		l[i] = int(l[i])
	l = sorted(l)
	if n == 2:
		return max(l) - min(l)
	for i in range(n // 2):
		s.append(int(l[n // 2]) - int(l[i]))
	return min(s)
for i in range(t):
	n = input()
	l = input()
	l = l.split()
	print(f(l))


def solve():
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	print(A[N] - A[N - 1])
T = int(input())
for i in range(0, T):
	solve()


from operator import itemgetter
from collections import Counter

def solve(n, a):
	a.sort()
	print(a[n] - a[n - 1])

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, list(input().split())))
		solve(n, a)
main()


y = input
for i in [0] * int(y()):
	n = int(y())
	l = sorted(map(int, input().split()))
	print(l[n] - l[n - 1])


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


n = int(input())
lis = []
for i in range(n):
	res = 1
	noel = int(input())
	inp = list(map(int, input().split()))
	inp.sort()
	res = inp[noel] - inp[noel - 1]
	lis.append(res)
for k in range(n):
	print(lis[k])


def solver(l, skills):
	sorted_skills = sorted(skills)
	print(sorted_skills[l] - sorted_skills[l - 1])
test_cases = input()
for test in range(int(test_cases)):
	l = int(input())
	skills = [int(x) for x in input().split()]
	solver(l, skills)


n = int(input())
for _ in range(n):
	input()
	num_list = sorted(map(int, input().split()))
	mid = len(num_list) // 2 - 1
	print(num_list[mid + 1] - num_list[mid])


for i in range(int(input())):
	n = int(input())
	a = [int(s) for s in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	ni = list(map(int, input().split()))
	ni.sort()
	i1 = n - 1
	i2 = n
	print(ni[i2] - ni[i1])


for i in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	print(a[n] - a[n - 1])


T = int(input())
for i in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	A = sorted(A)
	print(abs(A[n] - A[n - 1]))


t = int(input())
for __ in range(t):
	q = int(input())
	a = sorted(list(map(int, input().split())))
	print(a[len(a) // 2] - a[len(a) // 2 - 1])


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
for i in range(I()):
	n = I()
	a = li()
	b = []
	c = []
	a.sort()
	print(a[n] - a[n - 1])


def solve(A, N):
	assert len(A) == 2 * N
	A.sort()
	best = float('inf')
	for (i, x) in enumerate(A):
		lo = i + 1
		hi = 2 * N - i - 1
		if lo > hi:
			break
		mid = (lo + hi) // 2
		best = min(best, abs(A[i] - A[mid]))
	return best
(T,) = map(int, input().split())
for t in range(T):
	(N,) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, N)
	print(ans)


res = ''
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		res += str(abs(a[0] - a[1])) + '\n'
	else:
		a.sort()
		res += str(a[n] - a[n - 1]) + '\n'
print(res)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(n, lst):
	n *= 2
	lst = sorted(lst)
	return abs(lst[n // 2] - lst[n // 2 - 1])
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(solve(n, lst))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	m = 9999999999999999
	a.sort()
	print(a[n] - a[n - 1])


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	n = read_int()
	a = read_int_line()
	cnt = 1000000000.0
	a.sort()
	print(abs(a[len(a) // 2 - 1] - a[len(a) // 2]))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
input = sys.stdin.readline
ans = []
for _ in range(ii()):
	n = ii()
	d = li()
	d.sort()
	ans.append(d[n] - d[n - 1])
prr(ans, '\n')


def solve(a):
	a.sort()
	return a[len(a) // 2] - a[len(a) // 2 - 1]

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = [int(x) for x in input().split()]
		print(solve(a))
main()


def solve(n, a_s):
	a_s.sort()
	return a_s[n] - a_s[n - 1]

def __starting_point():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a_s = [int(ch) for ch in input().split(' ')]
		print(solve(n, a_s))
__starting_point()


ans = 0
cnt = 0
n = int(input())
for i in range(n):
	cnt = 0
	ans = 0
	s = int(input())
	f = list(map(int, input().split()))
	f.sort()
	print(abs(f[s] - f[s - 1]))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	n = iinp()
	arr = lmp()
	mn = inf
	arr.sort()
	print(arr[n] - arr[n - 1])


t = int(input())
cases = []
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	cases.append(a)
for c in cases:
	c.sort()
	l = len(c)
	print(c[l // 2] - c[l // 2 - 1])


t = int(input())
for x in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	l1.sort()
	print(l1[n] - l1[n - 1])


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	n *= 2
	print(a[n // 2] - a[n // 2 - 1])


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s = sorted(s, reverse=False)
	print(s[n] - s[n - 1])


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)
t = intput()
for _ in range(t):
	n = intput()
	n *= 2
	best = 10 ** 10
	a = list(intsput())
	a.sort()
	for i in range(n):
		op1 = a[i]
		if i <= (n - 2) // 2:
			idx = n // 2
		else:
			idx = (n - 2) // 2
		op2 = a[idx]
		tst = abs(op1 - op2)
		best = min(best, tst)
	print(best)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	s.sort()
	k1 = s[n - 1]
	k2 = s[n]
	print(abs(k2 - k1))


import os
import sys
from collections import deque, defaultdict
import math

class Pair:

	def __init__(self, x, y):
		self.x = x
		self.y = y
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	x = len(arr) // 2
	y = x - 1
	print(arr[x] - arr[y])


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	n = Input()[0]
	a = Input()
	a.sort()
	print(abs(a[n - 1] - a[n]))


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def pred(n, k, pointer):
	return pointer - k >= n

def yes():
	print('YES')

def no():
	print('NO')
for _ in range(inin()):
	n = inin()
	arr = inar()
	arr.sort()
	arr = [0] + arr
	print(arr[n + 1] - arr[n])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	m = len(l)
	k1 = m // 2
	k2 = k1 - 1
	d = l[k1] - l[k2]
	print(d)


t = int(input())
while int(t) > 0:
	n = int(input())
	q = input()
	a = q.split()
	for i in range(0, n * 2):
		a[i] = int(a[i])
	a.sort()
	s = a[n] - a[n - 1]
	print(s)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	v = sorted(v)
	print(v[n] - v[n - 1])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	w = sorted(map(int, input().split()))
	print(w[n] - w[n - 1])


t = int(input())
class1 = 0
class2 = 0
for i in range(t):
	n = int(input())
	k = 2 * n
	arr = list(map(int, input().strip().split()))[:k]
	arr.sort(reverse=True)
	for j in range(n):
		if j == n - 1:
			if class1 > class2:
				class1 = class1 + arr[n]
				class2 = class2 + arr[n - 1]
			else:
				class1 = class1 + arr[n - 1]
				class2 = class2 + arr[n]
		elif class1 > class2:
			class1 = class1 + arr[0] + arr[2 * n - j - 1]
		elif class2 > class1:
			class1 = class1 + arr[0] + arr[2 * n - j - 1]
	print(abs(class1 - class2))
	class1 = 0
	class2 = 0
	arr.clear()


import math

def inp_n():
	return int(input())

def inp_list():
	return list(map(int, input().split()))

def inp_mul_num():
	return map(int, input().split())

def is_odd(n):
	if n & 1:
		return True
	return False
for _ in range(inp_n()):
	n = inp_n()
	l = inp_list()
	l.sort()
	print(l[n] - l[n - 1])


T = int(input())
for _ in range(T):
	n = int(input())
	k = 2 * n
	arr = [int(x) for x in input().split()]
	arr.sort()
	l = int(len(arr) // 2)
	print(arr[l] - arr[l - 1])


import math
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	x = n * 2 // 2
	print(a[x] - a[x - 1])


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.sort()
	half = int(len(p) / 2)
	print(p[half] - p[half - 1])


t = int(input())
for i in range(t):
	n = int(input())
	class1 = []
	class2 = []
	inputs = list(map(int, input().split()))
	inputs.sort()
	if n % 2 == 1:
		for j in range(0, 2 * n, 2):
			class1.append(inputs[j])
			class2.append(inputs[j + 1])
		print(class2[int(len(class2) / 2)] - class1[int(len(class1) / 2)])
	else:
		for k in range(0, 2):
			class1.append(inputs[k])
		for l in range(2, 2 * n, 2):
			class2.append(inputs[l])
			class1.append(inputs[l + 1])
		print(class2[int(len(class2) / 2)] - class1[int(len(class1) / 2)])


tcases = int(input())
for case in range(tcases):
	num_s = int(input().strip())
	a = [int(x) for x in input().split(' ')]
	a = sorted(a)
	print(abs(a[num_s - 1] - a[num_s]))


test = int(input())
for _ in range(test):
	a = int(input())
	LIST = list(map(int, input().split()))
	LIST.sort()
	print(LIST[a] - LIST[a - 1])


from math import ceil, sqrt

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	a.sort()
	print(a[n] - a[n - 1])


from math import ceil, fabs
T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	if n % 2 == 0:
		a1 = arr[int(n / 2)]
		b1 = arr[n - 1]
		a2 = arr[n]
		b2 = arr[n + 1]
		answer += str(min(int(fabs(a1 - b2)), int(fabs(a2 - b1)))) + '\n'
	else:
		pos = ceil(n / 2)
		b = arr[pos * 2 - 1]
		a = arr[pos * 2 - 2]
		answer += str(int(fabs(a - b))) + '\n'
print(answer)


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

def ain():
	return map(int, input().split())

def fain():
	return map(float, input().split())
for _ in range(int(input())):
	n = int(input())
	l = list(ain())
	a = []
	b = []
	l.sort()
	print(l[n] - l[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	p = len(l)
	m = l[p // 2 - 1]
	n = l[p // 2]
	print(abs(m - n))


import sys
for test in range(int(input())):
	n = int(input())
	arr = [int(x) for x in sys.stdin.readline().split()]
	arr.sort()
	print(arr[n] - arr[n - 1])


t = int(input())
while t:
	n = int(input())
	n = 2 * n
	l = list(map(int, input().split()))
	l.sort()
	print(abs(l[n // 2] - l[n // 2 - 1]))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	abc = sorted(list(map(int, input().split())))
	print(abc[n] - abc[n - 1])


import math

def change_char(s, p, r):
	return s[:p] + r + s[p + 1:]
test = int(input())
while test > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[n] - arr[n - 1])
	test -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	A = list((int(i) for i in input().split()))
	A.sort()
	print(abs(A[n - 1] - A[n]))


from sys import stdin

def inp():
	return (ss.rstrip() for ss in stdin).__next__()

def itg():
	return int(inp())

def mpint():
	return map(int, inp().split())
for case in range(itg()):
	n = itg()
	arr = list(mpint())
	arr.sort()
	print(arr[n] - arr[n - 1])


def solution(n, nav):
	nav.sort()
	print(nav[n] - nav[n - 1])
t = int(input())
for i in range(t):
	n = int(input())
	nav = list(map(int, input().split()))
	solution(n, nav)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	m1 = a[len(a) // 2]
	m2 = a[len(a) // 2 - 1]
	print(m1 - m2)


t = int(input())
for a in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	print(abs(arr[n - 1] - arr[n]))


for z in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


t = int(input())
for j in range(t):
	n = int(input())
	p = 2 * n
	ls = list(map(int, input().split()))
	ls = sorted(ls)
	print(ls[p // 2] - ls[p // 2 - 1])


from sys import stdin, stdout
T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = a[n] - a[n - 1]
	stdout.write(str(ans) + '\n')


n1 = int(input())
for x in range(n1):
	n2 = int(input())
	n3 = input().split(' ')
	for y in range(2 * n2):
		n3[y] = int(n3[y])
	n3.sort()
	print(abs(n3[n2] - n3[n2 - 1]))


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	ar = [int(x) for x in inp().split()]
	ar.sort()
	print(abs(ar[n * 2 // 2 - 1] - ar[n * 2 // 2]))


import sys, math
MOD = 998244353

def diff(x, y):
	return abs(x[len(x) // 2] - y[len(y) // 2])
for i in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	(x, y) = ([], [])
	for i in range(n):
		x.append(a[2 * i])
		y.append(a[2 * i + 1])
	if n % 2 == 1:
		print(diff(x, y))
	else:
		xx = sorted(x[1:])
		yy = sorted(y[:] + [x[0]])
		ans = diff(xx, yy)
		xx = sorted(x[:-1])
		yy = sorted(y[:] + [x[-1]])
		ans = min(ans, diff(xx, yy))
		xx = sorted(x[:] + [y[0]])
		yy = sorted(y[1:])
		ans = min(ans, diff(xx, yy))
		xx = sorted(x[:] + [y[-1]])
		yy = sorted(y[:-1])
		ans = min(ans, diff(xx, yy))
		print(ans)


testCases = int(input())
for test in range(testCases):
	n = int(input())
	array = [int(x) for x in input().split()]
	array.sort()
	secondIndex = int(2 * n / 2)
	firstIndex = secondIndex - 1
	array.sort()
	print(abs(array[secondIndex] - array[firstIndex]))


t = int(input())
for _ in range(t):
	n = int(input())
	a1 = []
	k = list(map(int, input().split()))
	k1 = sorted(k)
	print(k1[n] - k1[n - 1])


n = int(input())
for i in range(n):
	q = int(input())
	l = list(map(int, input().split()))
	w = l[:]
	w.sort()
	x = w[q - 1]
	y = w[q]
	print(abs(x - y))


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	arr = sorted(list(map(int, input().split())))
	j = len(arr) // 2
	arr = arr[j - 1:j + 1]
	print(arr[1] - arr[0])


test = int(input())
for i in range(test):
	h = int(input())
	l = input().split()
	l = [int(i) for i in l]
	l.sort()
	k = l[h - 1]
	q = l[h]
	print(abs(k - q))


for i in range(int(input())):
	n = int(input())
	stu = list(map(int, input().split()))
	stu.sort()
	print(abs(stu[n] - stu[n - 1]))


t = int(input())
for i in range(t):
	p = int(input())
	a = list((int(x) for x in input().split()))
	a.sort()
	print(a[p] - a[p - 1])


for p in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	n = n * 2
	arr = list(inp())
	arr.sort()
	ans = arr[n // 2] - arr[n // 2 - 1]
	out(ans)


for j in range(int(input())):
	a = int(input())
	l1 = list(map(int, input().split()))
	l1.sort()
	b = l1[a] - l1[a - 1]
	print(b)


t = int(input())
for i in range(t):
	n = int(input())
	ch = input()
	L = [int(i) for i in ch.split()]
	L.sort()
	print(L[n] - L[n - 1])


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = list(map(int, input().split()))
		A.sort()
		print(A[N] - A[N - 1])

def __starting_point():
	main()
__starting_point()


t = int(input())
for j in range(t):
	n = int(input())
	a = list(sorted(list(map(int, input().split()))))
	print(a[n] - a[n - 1])


def main():

	def med(a):
		if len(a) == 1:
			return a[0]
		return sorted(a)[len(a) // 2]
	t = int(input())
	for qweqerq in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		b = a.pop(n)
		print(abs(b - med(a)))
main()


import sys
from math import *
input = sys.stdin.readline
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


n = int(input())
for i in range(n):
	s = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = abs(a[s] - a[s - 1])
	print(c)


t = int(input())
for _ in range(t):
	m = int(input())
	li = list(map(int, input().split()))
	li.sort()
	q = len(li) // 2
	d1 = li[q]
	d2 = li[q - 1]
	print(d1 - d2)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split(' ')]
	l.sort()
	d = l[n] - l[n - 1]
	print(d)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	n = 2 * n
	print(abs(li[n // 2 - 1] - li[n // 2]))


t = int(input())
s = []
for nfjn in range(0, t):
	n = 2 * int(input())
	f = int(n / 2 - 1)
	x = input()
	xx = x.split()
	for i in range(0, n):
		xx[i] = int(xx[i])
	xx.sort()
	h = int(xx[f + 1]) - int(xx[f])
	h = int(h)
	s.append(h)
for i in s:
	print(i)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		a = sorted(a)
		rr.append(a[n] - a[n - 1])
	return JA(rr, '\n')
print(main())


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
for i in range(ii()):
	n = ii()
	a = li()
	a.sort()
	b = a[n - 1]
	c = a[n]
	print(c - b)


t = int(input())
while t > 0:
	n = int(input())
	a = [int(i) for i in input().split()]
	b = sorted(a)
	ans = 0
	ans = abs(b[n] - b[n - 1])
	print(ans)
	t -= 1


def solve(lst):
	lst.sort()
	n = len(lst)
	return lst[n // 2] - lst[n // 2 - 1]
m = input()
for _ in range(int(m)):
	n = input()
	lst = list(map(int, input().split()))
	print(solve(lst))


import sys
from functools import reduce

def solution(arr, n):
	arr.sort()
	print(arr[n] - arr[n - 1])
for line in sys.stdin:
	t = int(line)
	break
p = 1
for line in sys.stdin:
	if p == 1:
		n = int(line)
	else:
		arr = [int(x) for x in line.split()]
		solution(arr, n)
	p *= -1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = [int(k) for k in input().split()]
	arr.sort()
	print(abs(arr[n] - arr[n - 1]))


test = int(input())
for i in range(test):
	nums = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	print(arr[nums] - arr[nums - 1])


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	print(l[n] - l[n - 1])


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def solve():
	n = int(inp()) * 2
	a = lis()
	a = sorted(a)
	print(a[n // 2] - a[(n - 1) // 2])
testcase(int(inp()))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	ans = a[n] - a[n - 1]
	print(ans)


n = int(input())
for i in range(n):
	k = int(input())
	s = sorted([int(i) for i in input().split()])
	mid = len(s) // 2
	print(abs(s[mid - 1] - s[mid]))


from sys import stdin, stdout
from math import sqrt

def main():
	t = int(input())
	for c in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		print(arr[n] - arr[n - 1])
main()


def class_assign(a):
	m = len(a)
	n = m // 2
	a.sort()
	return a[n] - a[n - 1]
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	ans = class_assign(a)
	print(ans)


for t in range(int(input())):
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	k1 = a[0::2]
	k2 = a[1::2]
	if n % 2 == 0:
		k2.append(k1[0])
		k2.sort()
		k1 = k1[1:]
	ans = abs(k1[len(k1) // 2] - k2[len(k2) // 2])
	print(ans)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.sort()
	print(b[a] - b[a - 1])


import sys
from statistics import median
input = sys.stdin.readline
for _ in range(int(input().strip())):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	arr.sort()
	(l, r) = ([], [])
	for i in range(n - 1):
		if i & 1:
			l.append(arr[i])
			l.append(arr[2 * n - i - 1])
		else:
			r.append(arr[i])
			r.append(arr[2 * n - i - 1])
	l.append(arr[n - 1])
	r.append(arr[n])
	print(abs(median(l) - median(r)))


def solve():
	n = int(input()) * 2
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[n // 2] - arr[n // 2 - 1])
for _ in range(int(input())):
	solve()


kl = int(input())
for l in range(kl):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		print(abs(a[n] - a[n - 1]))
main()


test = int(input())
for t in range(test):
	n = int(input())
	L = list(map(int, input().split()))
	L.sort()
	print(L[n] - L[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = l[n]
	b = l[n - 1]
	print(a - b)


t = int(input())
while t:
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort()
	mid2 = len(l) // 2
	mid1 = mid2 - 1
	print(l[mid2] - l[mid1])
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = n - 1
	j = n
	a.sort()
	min_diff = a[j] - a[i]
	print(min_diff)


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(abs(l[n] - l[n - 1]))


a = int(input())
for i in range(a):
	b = int(input())
	ans = 0
	c = list(map(int, input().split()))
	c.sort()
	print(c[b] - c[b - 1])


t = int(input())
for v in range(t):
	n = int(input())
	li = list(map(int, input().split(' ')))
	li.sort()
	print(li[n] - li[n - 1])


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split()]
		a.sort()
		print(a[n] - a[n - 1])
main()


from collections import defaultdict
from itertools import permutations
from os import system
import sys
import queue
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[n] - arr[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	skills = list(map(int, input().split()))
	skills.sort()
	value = abs(skills[n] - skills[n - 1])
	print(value)


from copy import *
from math import *
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(abs(l[1] - l[0]))
		continue
	l = deepcopy(sorted(l))
	med = sum(l) / len(l)
	an = len(l) // 2
	var = 0
	t = 0
	if abs(med - l[an - 1]) < abs(med - l[an]):
		var = l[an - 1]
		t = 1
	else:
		var = l[an]
		t = 2
	l1 = [var]
	if t == 1:
		l2 = l[:an - 1] + l[an:]
	else:
		l2 = l[:an] + l[an + 1:]
	med1 = l1[0]
	med2 = l2[len(l2) // 2]
	print(abs(med1 - med2))


from sys import stdin, stdout
from statistics import median
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = sorted(list(map(int, stdin.readline().split())))
	if n % 2 == 1:
		d = abs(median(a[::2]) - median(sorted(a[::-2])))
		stdout.write(str(d) + '\n')
	else:
		b = a.pop(n)
		d = abs(b - median(a))
		stdout.write(str(d) + '\n')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	x = []
	y = []
	for i in range(0, 2 * n - 1, 2):
		x.append(a[i])
		y.append(a[i + 1])
	if n % 2 == 0:
		b1 = y.copy()
		b1.append(x[-1])
		b1.sort()
		ans = abs(x[n // 2 - 1] - b1[n // 2])
		x.append(y[-1])
		x.sort()
		ans = min(ans, abs(x[n // 2] - y[n // 2 - 1]))
		print(ans)
	else:
		print(abs(x[n // 2] - y[n // 2]))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def skilllevel():
	for _ in range(t):
		n = int(input())
		(*a,) = [int(x) for x in input().split()]
		a.sort()
		yield (a[n] - a[n - 1])
t = int(input())
ans = skilllevel()
print(*ans, sep='\n')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = sorted(arr)
	if n % 2 == 1:
		p = (n + 1) // 2
		arr1 = [arr[i] for i in range(0, 2 * n, 2)]
		arr2 = [arr[i] for i in range(1, 2 * n, 2)]
		print(abs(arr1[p - 1] - arr2[p - 1]))
	else:
		print(abs(arr[n] - arr[n - 1]))


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		A = list(map(int, input().split()))
		A.sort()
		ans = A[N] - A[N - 1]
		print(ans)
main()


def solve():
	n = int(input())
	m = list(map(int, input().split()))
	m.sort()
	print(m[n] - m[n - 1])
t = int(input())
while t:
	solve()
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = l[n - 1]
	b = l[n]
	res = b - a
	print(res)


R = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	n = int(input())
	a = R()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 9999999999999999999999
	for i in range(n):
		j = i
		rem = 2 * n - (2 * j + 1)
		temp = i + 1 + rem // 2
		ans = min(ans, abs(a[i] - a[temp]))
	a = sorted(a, reverse=True)
	for i in range(n):
		j = i
		rem = 2 * n - (2 * j + 1)
		temp = i + 1 + rem // 2
		ans = min(ans, abs(a[i] - a[temp]))
	print(ans)


qq = int(input())
for _ in range(qq):
	n = int(input())
	dat = list(map(int, input().split()))
	dat.sort()
	print(dat[n] - dat[n - 1])


import sys
for _ in range(int(sys.stdin.readline().split()[0])):
	n = int(sys.stdin.readline().split()[0])
	a = list(map(int, sys.stdin.readline().split()))
	a.sort()
	minn = 10 ** 9
	for x in range(n):
		if a[n] - a[x] < minn:
			minn = a[n] - a[x]
	print(minn)


from bisect import bisect_left

def main():
	t = int(input().strip())
	for _ in range(t):
		n = int(input().strip())
		A = [int(s) for s in input().strip().split()]
		A.sort()
		result = float('inf')
		for i in range(n):
			m = A[i]
			j = bisect_left(A, -m, lo=n, hi=n + i + 1)
			if j < len(A):
				result = min(result, abs(m - A[j]))
			if j - 1 >= n:
				result = min(result, abs(m - A[j - 1]))
		print(result)
main()


def one():
	return int(input())

def two():
	return map(int, input().split())

def lis():
	return list(map(int, input().split()))

def st():
	return input()

def dist(x):
	return (x[0] ** 2 + x[1] ** 2) ** 0.5
for _ in range(one()):
	input()
	l = lis()
	if len(l) // 2 % 2 == 1:
		l.sort()
		print(abs(l[len(l) // 2] - l[len(l) // 2 - 1]))
	else:
		l.sort()
		a = (len(l) - 2) // 2 - 1
		b = (len(l) - 2) // 2
		print(min(abs(l[a] - l[b + 2]), abs(l[a + 2] - l[b])))


I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	a.sort()
	print(a[n] - a[n - 1])


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from decimal import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
M = 10 ** 9 + 7
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynum(x, l, r, a):
	if x >= l and x <= r:
		a.append(x)
	if x > r:
		a.append(x)
		return a
	if x < 10000000000.0:
		luckynum(x * 10 + 4, l, r, a)
		luckynum(x * 10 + 7, l, r, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def factorization(n, l):
	c = n
	if prime(n) == True:
		l.append(n)
		return l
	for i in range(2, c):
		if n == 1:
			break
		while n % i == 0:
			l.append(i)
			n = n // i
	return l

def good(b):
	l = []
	i = 0
	while len(b) != 0:
		if b[i] < b[len(b) - 1 - i]:
			l.append(b[i])
			b.remove(b[i])
		else:
			l.append(b[len(b) - 1 - i])
			b.remove(b[len(b) - 1 - i])
	if l == sorted(l):
		return True
	return False

def generate(st, s):
	if len(s) == 0:
		return
	if s not in st:
		st.add(s)
		for i in range(len(s)):
			t = list(s).copy()
			t.remove(s[i])
			t = ''.join(t)
			generate(st, t)
	return

def largestincreasingsubsequence(A):
	l = [1] * len(A)
	sub = []
	for i in range(1, len(l)):
		for k in range(i):
			if A[k] < A[i]:
				sub.append(l[k])
		l[i] = 1 + max(sub, default=0)
	return max(l, default=0)

def findOR(nums, N):
	prefix_sum = 0
	result = 0
	for i in range(N):
		result |= nums[i]
		prefix_sum += nums[i]
		result |= prefix_sum
	return result

def OR(a, n):
	ans = a[0]
	for i in range(1, n):
		ans |= a[i]
	return ans

def toString(List):
	return ''.join(List)
p = []

def permute(a, l, r):
	if l == r:
		p.append(toString(a))
	else:
		for i in range(l, r + 1):
			(a[l], a[i]) = (a[i], a[l])
			permute(a, l + 1, r)
			(a[l], a[i]) = (a[i], a[l])

def squareRoot(number, precision):
	start = 0
	(end, ans) = (number, 1)
	while start <= end:
		mid = int((start + end) / 2)
		if mid * mid == number:
			ans = mid
			break
		if mid * mid < number:
			start = mid + 1
		else:
			end = mid - 1
	increment = 0.1
	for i in range(0, precision):
		while ans * ans <= number:
			ans += increment
		ans = ans - increment
		increment = increment / 10
	return ans
import math

def countRectangles(l, w):
	squareSide = math.gcd(l, w)
	return int(l * w / (squareSide * squareSide))

def count_same_digit(L, R):
	tmp = 0
	ans = 0
	n = int(math.log10(R) + 1)
	for i in range(0, n):
		tmp = tmp * 10 + 1
		for j in range(1, 10):
			if L <= tmp * j and tmp * j <= R:
				ans += 1
	return ans

def main():
	for _ in range(inpu()):
		n = inpu()
		arr = lis()
		arr.sort()
		(a, b) = ([], [])
		cnt = 0
		for i in arr:
			if cnt % 2 == 0:
				a.append(i)
			else:
				b.append(i)
			cnt += 1
		if len(a) % 2 == 0:
			p = a.pop(0)
			b = [p] + b
		print(abs(b[len(b) // 2] - a[len(a) // 2]))
main()


def absolute_diff(n, arr):
	arr.sort()
	index = len(arr) // 2
	return abs(arr[index] - arr[index - 1])
t = int(input())
tests = []
for i in range(t):
	tests.append((int(input()), list(map(int, input().rstrip().split()))))
for t in tests:
	print(absolute_diff(t[0], t[1]))


q = int(input())
while q:
	q += -1
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


whatever = int(input())
for i in range(whatever):
	n = int(input())
	k = sorted(list(map(int, input().split())))
	print(abs(k[n - 1] - k[n]))


t = int(input())
for _ in range(t):
	k = int(input())
	b = list(map(int, input().split()))
	b.sort()
	print(b[len(b) // 2] - b[len(b) // 2 - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	l = sorted(list(map(int, input().split())))
	a = l[n]
	b = l[n - 1]
	print(abs(a - b))


T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if n > 1:
		a.sort()
		diff1 = a[len(a) // 2] - a[len(a) // 2 - 1]
		print(diff1)
	else:
		print(abs(a[0] - a[1]))


for _ in range(int(input())):
	N = int(input())
	array = sorted([int(x) for x in input().split()])
	print(array[N] - array[N - 1])


t = int(input(''))
ans = [0] * t
a1 = []
for x in range(0, t):
	n = int(input('')) * 2
	a1 = a1.clear()
	a1 = input('').split()
	a = sorted(a1, key=int)
	a = [int(z) for z in a]
	ans[x] = a[int(n / 2)] - a[int(n / 2 - 1)]
for y in range(0, t):
	print(ans[y])


import sys
for (i, line) in enumerate(sys.stdin):
	if i == 0:
		t = int(line.split()[0])
	elif i % 2 != 0:
		n = int(line.split()[0])
	else:
		sorted_grades = sorted(list(map(int, line.split(' '))))
		print(sorted_grades[n] - sorted_grades[n - 1])


def solve():
	n = int(input())
	arr = sorted(map(int, input().split()))
	print(arr[n] - arr[n - 1])
for _ in range(int(input())):
	solve()


t = int(input())
out = []
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.sort()
	res = nums[n] - nums[n - 1]
	out.append(res)
for i in out:
	print(i)


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		n = int(input())
		arr = sorted(read())
		ans = INF
		n *= 2
		for i in range(n):
			left = i
			right = n - i - 1
			if left <= right:
				mid_idx = (left + 1 + right) // 2
			else:
				mid_idx = (right + (left - 1)) // 2
			ans = min(ans, abs(arr[i] - arr[mid_idx]))
		print(ans)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


import sys
t = int(sys.stdin.readline().rstrip())
for _ in range(t):
	n = int(sys.stdin.readline().rstrip())
	s = list(map(int, sys.stdin.readline().rstrip().split()))
	s.sort()
	sol = abs(s[n - 1] - s[n])
	print(sol)


for _ in range(int(input())):
	n = int(input())
	arr = sorted([int(i) for i in input().split()])
	print(arr[n] - arr[n - 1])


t = int(input())
for query in range(t):
	k = int(input())
	a = input().split()
	for x in range(k * 2):
		a[x] = int(a[x])
	a = sorted(a)
	print(a[k] - a[k - 1])


test = int(input())
for i in range(test):
	a = int(input())
	rand = list(map(int, input().split()))
	rand.sort()
	diff = rand[a] - rand[a - 1]
	print(diff)


T = int(input())
for _ in range(T):
	n = int(input())
	skills = sorted(list(map(int, input().split())))
	median1 = skills[n - 1]
	median2 = skills[n]
	diff = abs(median1 - median2)
	print(diff)


n = int(input())
for _ in range(n):
	t = int(input())
	l = [int(x) for x in input().split()]
	a = l.count(0)
	l.sort()
	print(l[t] - l[t - 1])


import math
I = input
pr = print
for _ in ' ' * int(I()):
	n = int(I())
	s = sorted(map(int, I().split()))
	print(s[n] - s[n - 1])


for _ in range(int(input())):
	x = int(input())
	l = sorted(list(map(int, input().split())))
	print(l[x] - l[x - 1])


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(k) for k in input().split()]
	a = sorted(a)
	print(abs(a[n] - a[n - 1]))


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	c = a[n] - a[n - 1]
	c = int(math.fabs(c))
	print(c)


for _ in range(int(input())):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	p1 = a[n]
	p2 = a[n - 1]
	print(p1 - p2)


t = int(input())
for case in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	inp.sort()
	ans = inp[n] - inp[n - 1]
	print(ans)


t = int(input())
for i in range(t):
	n = 2 * int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = max(l) - min(l)
	for j in range(n // 2):
		ans = min(abs(l[j] - l[n // 2]), ans)
	for j in range(n // 2, n):
		ans = min(abs(l[j] - l[n // 2 - 1]), ans)
	print(ans)


for _ in range(int(input())):
	N = int(input())
	X = sorted(list(map(int, input().split())))
	print(X[N] - X[N - 1])


t = int(input())
import math
from queue import PriorityQueue
for ti in range(t):
	n = int(input())
	li = [int(i) for i in input().split(' ')]
	li.sort()
	t1 = t2 = n
	t1 = n - 1
	flg = 0
	ans = 192608171919810
	print(abs(li[t2] - li[t1]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	sw = 0
	b1 = []
	b2 = []
	for i in range(2 * n):
		if sw:
			b1.append(a[i])
		else:
			b2.append(a[i])
		sw ^= 1
	if n % 2:
		print(abs(b1[n // 2] - b2[n // 2]))
	else:
		print(min(abs(b1[n // 2 - 1] - b2[n // 2]), abs(b1[n // 2] - b2[n // 2 - 1])))


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	n = int(sys.stdin.readline().strip())
	a = list(map(int, sys.stdin.readline().strip().split()))
	a.sort()
	print(a[n] - a[n - 1])


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	mid = li[n] - li[n - 1]
	print(mid)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	(ma1, ma2) = (-float('inf'), -float('inf'))
	(c, d) = ([], [])
	if n % 2:
		for i in range(2 * n):
			if i % 2 == 0:
				c.append(a[i])
			else:
				d.append(a[i])
		c.sort()
		d.sort()
		x = c[n // 2]
		y = d[n // 2]
		print(abs(x - y))
	else:
		n = 2 * n
		x = a[n // 2]
		y = a[n // 2 - 1]
		print(abs(x - y))


from sys import *
from bisect import bisect_left as bl, bisect_right as br, bisect
from math import *
from time import clock as cl
from itertools import zip_longest as zl
from itertools import groupby as gb
from itertools import combinations as comb
from itertools import combinations_with_replacement as cwr
from collections import defaultdict as dd
from collections import deque as dq
from collections import Counter as c
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return input()

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [[val for i in range(n)] for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	arr = sorted(arr)
	print(arr[n] - arr[n - 1])


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	print(abs(arr[n] - arr[n - 1]))


n = int(input())
while n:
	halved = int(input())
	skills = list(map(int, input().split()))
	skills = sorted(skills)
	ans = skills[halved] - skills[halved - 1]
	print(ans)
	n -= 1


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		arr.sort()
		print(arr[n] - arr[n - 1])
main()


from sys import stdin, stdout
insize = int(stdin.readline().replace('\n', ''))
asize = []
a1 = []
for x in range(insize):
	asize = stdin.readline().replace('\n', '')
	a1.append(stdin.readline().replace('\n', '').split(' '))
for item in a1:
	for x in range(len(item)):
		test = item[x]
		item[x] = int(test)
	item.sort()
	print(item[int(len(item) / 2)] - item[int(len(item) / 2) - 1])


q = int(input(''))
for i in range(0, q):
	n = int(input(''))
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr = sorted(arr)
	print(arr[n] - arr[n - 1])


N = int(input())
nu = []
for i in range(N):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	num = a[n] - a[n - 1]
	nu.append(num)
for k in nu:
	print(k)


def odd(l, n):
	return l[n] - l[n - 1]
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	o = odd(l, n)
	print(o)


import sys
from pprint import pprint
if not 'DEBUG' in globals():
	readline = sys.stdin.readline

def read(map_func):
	return map_func(readline().rstrip())

def reads(map_func):
	return list(map(map_func, readline().rstrip().split()))

def readint():
	return read(int)

def readints():
	return reads(int)

def readcol(n):
	return [readint() for _ in range(n)]

def readmat(n):
	return [readints() for _ in range(n)]

def makemat(n, m, v):
	return [[v for _ in range(n)] for _ in range(m)]

def zeromat(n, m=None):
	return makemat(n, m if m else n, 0)

def listmat(n, m=None):
	return [[[] for _ in range(n)] for _ in range(m if m else n)]

def crosslist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x), (y, x - 1), (y + 1, x)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def roundlist(y, x, n=None, m=None):
	return [(p, q) for (p, q) in [(y, x + 1), (y - 1, x + 1), (y - 1, x), (y - 1, x - 1), (y, x - 1), (y + 1, x - 1), (y + 1, x), (y + 1, x + 1)] if (n == None or 0 <= p < n) and (m == None or 0 <= q < m)]

def log(obj):
	pprint(obj) if 'DEBUG' in globals() else None
T = readint()
for t in range(T):
	N = readint()
	A = sorted(readints())
	print(abs(A[N - 1] - A[N]))


for _ in range(0, int(input())):
	n = int(input())
	v = sorted(map(int, input().split()))
	print(v[n] - v[n - 1])


mod = 1000000007
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	arr = []
	for j in x.split(' '):
		arr.append(int(j))
	mergeSort(arr)
	print(arr[n] - arr[n - 1])


t = int(input())
r = []
for i in range(t):
	n = int(input())
	a = sorted(map(int, input().split()))
	r.append(a[n] - a[n - 1])
for j in range(len(r)):
	print(r[j])


import math
import operator

def lcm(a, b):
	return a / math.gcd(a, b) * b

def nCr(n, r):
	return math.factorial(n) / (math.factorial(r) * math.factorial(n - r))

def isKthBitSet(n, k):
	if n & 1 << k - 1:
		return True
	else:
		return False

def maximalRectangle(matrix):
	if not matrix or not matrix[0]:
		return 0
	n = len(matrix[0])
	height = [0] * (n + 1)
	ans = 0
	for row in matrix:
		for i in range(n):
			height[i] = height[i] + 1 if row[i] == '0' else 0
		stack = [-1]
		for i in range(n + 1):
			while height[i] < height[stack[-1]]:
				h = height[stack.pop()]
				w = i - 1 - stack[-1]
				ans = max(ans, h * w)
			stack.append(i)
	return ans

def matched(str):
	count = 0
	for i in str:
		if i == '(':
			count += 1
		elif i == ')':
			count -= 1
		if count < 0:
			return False
	return count == 0

def isValid(h, m, nh, nm):
	l = [0, 1, 5, -1, -1, 2, -1, -1, 8, -1]
	if l[h // 10] == -1 or l[h % 10] == -1 or l[m // 10] == -1 or (l[m % 10] == -1):
		return False
	resh = l[m % 10] * 10 + l[m // 10]
	resm = l[h % 10] * 10 + l[h // 10]
	return resh < nh and resm < nm

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	n *= 2
	print(abs(l[n // 2] - l[n // 2 - 1]))
t = int(input())
while t > 0:
	t -= 1
	solve()


t = int(input())
for k in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	first = arr[::2]
	second = arr[1::2]
	if len(first) % 2 and (not len(second) % 2):
		first = [second[0]] + first[:] + [second[-1]]
		second = second[1:-1]
	elif not len(first) % 2 and len(second) % 2:
		second = [first[0]] + second[:] + [first[-1]]
		first = first[1:-1]
	elif not len(first) % 2 and (not len(second) % 2):
		first = first[:] + [second[-1]]
		second = second[:-1]
	print(abs(first[len(first) // 2] - second[len(second) // 2]))


import sys
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(eval(input().replace(' ', ',')))
	if type(arr) is int:
		arr = [arr]
	arr.sort()
	print(arr[n] - arr[n - 1])
	sys.stdout.flush()


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		print(a[n] - a[n - 1])
	return
main()


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	t = iin()
	while t:
		t -= 1
		n = iin()
		a = lin()
		a.sort()
		print(abs(a[n] - a[n - 1]))
main()


import sys, collections, math, itertools, random, bisect
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = int(1000000000.0 + 7)
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


from math import *
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = abs(arr[n] - arr[n - 1])
	print(ans)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	print(abs(a[n - 1] - a[n]))


for _ in ' ' * int(input()):
	a = int(input())
	d = sorted(list(map(int, input().split())))
	print(d[a] - d[a - 1])


a = int(input())
for i in range(0, a):
	S1 = 0
	S2 = 0
	n = int(input())
	arr = map(int, input().split())
	arr = list(arr)
	arr.sort()
	print(arr[n] - arr[n - 1])


t = int(input())

def med(tab):
	if len(tab) % 1 == 0:
		return (tab[len(tab) // 2] + tab[len(tab) // 2 - 1]) / 2
	return tab[len(tab) // 2]
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[len(a) // 2] - a[len(a) // 2 - 1]))


T = int(input())
for t in range(T):
	n = int(input())
	A = sorted([int(i) for i in input().split()])
	print(A[n] - A[n - 1])


t = int(input())
for p in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	lis.sort()
	print(lis[n] - lis[n - 1])


def customer(l, n):
	l.sort()
	return abs(l[n] - l[n - 1])
t = int(input())
for _ in range(t):
	n = int(input())
	queries = list(map(int, input().split()))
	print(customer(queries, n))


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	x = []
	y = []
	for i in range(len(a)):
		if i % 2 == 0:
			x.append(a[i])
		else:
			y.append(a[i])
	if n % 2 == 0:
		x.append(y.pop())
	print(abs(x[len(x) // 2] - y[len(y) // 2]))
	t -= 1


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = a[n] - a[n - 1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	array = sorted(list(map(int, input().split())))
	res = array[n] - array[n - 1]
	print(res)


import math
import functools

def calculate(data):
	data.sort()
	middle = len(data) // 2
	value = abs(data[middle] - data[middle - 1])
	return value
T = int(input())
for i in range(T):
	length = int(input())
	data = list(map(int, input().split()))
	print(calculate(data))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(sorted([int(x) for x in input().split()]))
	print(a[n] - a[n - 1])


from itertools import permutations
import math
import sys
t = int(input())
for i in range(0, t):
	n = int(input())
	a = input().split(' ')
	for i in range(0, 2 * n):
		a[i] = int(a[i])
	a.sort()
	print(a[n] - a[n - 1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = sorted(l, reverse=True)
	x = abs(l[2 * n // 2] - l[2 * n // 2 - 1])
	print(x)


n = int(input())
inputs_length = []
inputs = []
for _ in range(n):
	length = int(input())
	inputs_length.append(length)
	origin_input = input().split()
	inputs_tmp = []
	for i in range(length * 2):
		inputs_tmp.append(int(origin_input[i]))
	inputs.append(inputs_tmp)
for (nums, length) in zip(inputs, inputs_length):
	nums.sort()
	mid = length - 1
	min = nums[-1] - nums[0]
	for i in range(length - 1):
		new_length = len(nums) // 2
		min1 = abs(nums[new_length] - nums[new_length - 1])
		if min1 < min:
			min = min1
		nums.pop()
		nums.pop(0)
	print(min)


def select(L, j):
	if len(L) < 10:
		L.sort()
		return L[j]
	S = []
	lIndex = 0
	while lIndex + 5 < len(L) - 1:
		S.append(L[lIndex:lIndex + 5])
		lIndex += 5
	S.append(L[lIndex:])
	Meds = []
	for subList in S:
		Meds.append(select(subList, int((len(subList) - 1) / 2)))
	med = select(Meds, int((len(Meds) - 1) / 2))
	L1 = []
	L2 = []
	L3 = []
	for i in L:
		if i < med:
			L1.append(i)
		elif i > med:
			L3.append(i)
		else:
			L2.append(i)
	if j < len(L1):
		return select(L1, j)
	elif j < len(L2) + len(L1):
		return L2[0]
	else:
		return select(L3, j - len(L1) - len(L2))
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(abs(select(a, n) - select(a, n - 1)))


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	l.sort()
	print(l[n] - l[n - 1])
for _ in range(inp()):
	solve()


t = int(input())
for i in range(t):
	input()
	a = [*map(int, input().split())]
	a.sort()
	l = len(a)
	print(a[l // 2] - a[l // 2 - 1])


t = int(input())
for i in range(t):
	n = int(input())
	n = 2 * n
	a = [int(number) for number in input().split()]
	a = sorted(a)
	print(abs(a[n // 2 - 1] - a[n // 2]))


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(j) for j in input().split()]
	s.sort()
	print(s[n] - s[n - 1])


for ii in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[n - 1] - a[n]))


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	for i1 in input().split():
		a.append(int(i1))
	a.sort()
	print(abs(int(a[n - 1]) - int(a[n])))


for ahah in range(int(input())):
	n = int(input())
	mas = sorted(list(map(int, input().split())))
	print(mas[n] - mas[n - 1])


import math

def solve():
	n = int(input())
	table = list(map(int, input().split()))
	table.sort()
	print(table[n] - table[n - 1])

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


from sys import stdin, stdout
tt = int(stdin.readline())
while tt > 0:
	ans = 0
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = a[n] - a[n - 1]
	stdout.write(str(ans) + '\n')
	tt -= 1


from sys import stdin, stdout

def main():
	T = int(stdin.readline())
	for _ in range(T):
		n = int(stdin.readline())
		arr = list(map(int, stdin.readline().split()))
		arr.sort()
		if n % 2 == 1:
			stdout.write(str(arr[int(n)] - arr[int(n - 1)]) + '\n')
		else:
			stdout.write(str(arr[int(n)] - arr[int(n - 1)]) + '\n')
main()


def f():
	n = int(input())
	l1 = input().split(' ')
	l2 = [int(i) for i in l1]
	l2.sort()
	print(l2[n] - l2[n - 1])
row = int(input())
for r in range(row):
	f()


t = int(input())
for x in range(t):
	n = int(input())
	n = n * 2
	a = list(map(int, input().split()))
	a.sort()
	m = float('inf')
	for x in range(1, n, 2):
		s = abs(a[x // 2 + 1] - a[n - (x // 2 + 1) - 1])
		if s < m:
			m = s
	print(m)


def main():
	t = int(input().strip())
	for _ in range(t):
		n = int(input().strip())
		A = [int(s) for s in input().strip().split()]
		A.sort()
		result = A[n] - A[n - 1]
		print(result)
main()


from _collections import OrderedDict
from math import fabs
t = int(input())
while t:
	t -= 1
	n = int(input())
	mas = [int(i) for i in input().split()]
	mas.sort()
	print(int(fabs(mas[n] - mas[n - 1])))


q = int(input())
for e in range(q):
	l = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(arr[l] - arr[l - 1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n % 2 != 0:
		k = n // 2
		a = l[::2]
		b = l[1::2]
		print(abs(a[k] - b[k]))
	else:
		k = n // 2 - 1
		j = n // 2
		a = l[1:2 * n - 1:2]
		b = l[::2] + [l[-1]]
		print(abs(a[k] - b[j]))


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	c = 0
	x = input()
	a = x.split()
	for i in range(len(a)):
		a[i] = int(a[i])
	a = sorted(a)
	x = int(len(a) / 2)
	ans = a[x] - a[x - 1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	l.sort()
	print(l[n] - l[n - 1])


import math
t = int(input())
for x in range(t):
	n = int(input())
	raw_arr = input()
	arr = raw_arr.split()
	arr = [int(i) for i in arr]
	arr = sorted(arr)
	print(arr[n] - arr[n - 1])


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(s) for s in input().split()]
	arr.sort()
	if n % 2 == 0:
		last = arr[-1]
		sec_last = arr[-2]
		arr = arr[:-2]
		ans1 = []
		ans2 = []
		i = 0
		while i < 2 * (n - 1):
			ans1.append(arr[i])
			ans2.append(arr[i + 1])
			i += 2
		ans1.append(sec_last)
		ans1.append(last)
		m1 = ans1[int(n / 2)]
		m2 = ans2[int((n - 2) / 2)]
		ans_arr = [abs(m1 - m2)]
		ans1 = ans1[:-2]
		ans2.append(sec_last)
		ans2.append(last)
		m1 = ans1[int((n - 2) / 2)]
		m2 = ans2[int(n / 2)]
		ans_arr.append(abs(m1 - m2))
		print(min(ans_arr))
	else:
		ans1 = []
		ans2 = []
		i = 0
		while i < 2 * n:
			ans1.append(arr[i])
			ans2.append(arr[i + 1])
			i += 2
		m1 = ans1[int((n - 1) / 2)]
		m2 = ans2[int((n - 1) / 2)]
		ans = abs(m1 - m2)
		print(ans)


t = int(input())
for sai in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	ele1 = l[n - 1]
	ele2 = l[n]
	print(ele2 - ele1)


t = int(input())
for test in range(t):
	num_half_students = int(input())
	skill_students = list(map(int, input().split()))
	skill_students.sort()
	print(skill_students[num_half_students] - skill_students[num_half_students - 1])


t = int(input())
for j in range(t):
	n = int(input())
	l = input().split(' ')
	for i in range(len(l)):
		l[i] = int(l[i])
	l.sort()
	op = l[n] - l[n - 1]
	print(op)


t: int = int(input())
for k in range(t):
	n: int = int(input())
	students = list(map(lambda x: int(x), input().split(' ')))
	students.sort()
	print(abs(students[n] - students[n - 1]))


def solve(n, arr):
	ans = 0
	arr.sort()
	return arr[n // 2] - arr[n // 2 - 1]
t = int(input())
for i in range(t):
	n = int(input()) * 2
	arr = list(map(int, input().split()))
	print(solve(n, arr))


cases = int(input())
for _ in range(cases):
	n = int(input())
	c = sorted(list(map(int, input().split())))
	l = c[:n]
	l2 = c[n:]
	print(min(l2) - max(l))


from math import *
from math import factorial as fact, comb as ncr
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import search
inp = lambda : int(input())
li = lambda : list(map(int, input().split()))
lb = lambda : list(map(int, input()))
ls = lambda : list(input())
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def solve(__=1):
	for _ in range(__):
		n = inp()
		a = sorted(li())
		print(a[n] - a[n - 1])
solve(inp())


t = int(input())
for x in range(t):
	n = int(input())
	students = [int(i) for i in input().split(' ')]
	students.sort()
	print(students[n] - students[n - 1])


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.sort(reverse=True)
	ind = 0
	P = []
	S = []
	for i in l:
		if ind % 2 == 0:
			P.append(i)
		else:
			S.append(i)
		ind += 1
	if n % 2 == 0:
		a = abs(P[n // 2 - 1] - S[n // 2])
		b = abs(S[n // 2 - 1] - P[n // 2])
		print(min(a, b))
	else:
		print(abs(P[n // 2] - S[n // 2]))


n = int(input())
for t in range(n):
	x = int(input())
	sc = sorted(list(map(int, input().split())))
	print(abs(sc[x] - sc[x - 1]))


t = int(input())
for zz in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


import random
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[n] - a[n - 1]))


import math

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	print(abs(a[n - 1] - a[n]))

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
for _ in range(t):
	n = int(input())
	lol = [int(n) for n in input().split()]
	lol.sort()
	print(lol[n] - lol[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	a.sort()
	print(abs(a[n] - a[n - 1]))


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ans.append(str(arr[n] - arr[n - 1]))
print('\n'.join(ans))


def iinput():
	return [int(x) for x in input().split()]

def main():
	n = int(input())
	data = iinput()
	data.sort()
	return abs(data[n] - data[n - 1])
for t in range(int(input())):
	print(main())


from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = sorted(map(int, input().split()))
	print(abs(a[n] - a[n - 1]))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


import sys, itertools, math
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	A = [int(i) for i in sys.stdin.readline().strip().split(' ')]
	A = sorted(A)
	print(abs(A[n - 1] - A[n]))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])
for _ in range(int(input())):
	solve()


t = int(input())
for item in range(t):
	n = int(input())
	string = input()
	lists = string.split(' ')
	for x in range(2 * n):
		lists[x] = int(lists[x])
	lists.sort()
	print(lists[n] - lists[n - 1])


def main(n, xs):
	xs = sorted(xs)
	return abs(xs[n - 1] - xs[n])
t = int(input())
for _ in range(t):
	n = int(input())
	xs = [int(x) for x in input().split()]
	print(main(n, xs))


t = int(input())
for _ in range(t):
	n = int(input()) * 2
	s = sorted(map(int, input().split()))
	if n == 2:
		print(s[1] - s[0])
	else:
		print(s[n // 2] - s[n // 2 - 1])


for i in range(int(input())):
	n = int(input())
	a = list(sorted(map(int, input().split())))
	print(abs(a[n] - list(reversed(a))[n]))


import math as m
q = int(input())
for _ in range(q):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


test_cases = int(input())
for _ in range(test_cases):
	array_len = int(input())
	array = list(map(int, input().split()))
	array.sort()
	print(array[array_len] - array[array_len - 1])


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	lst = list()
	lst1 = list()
	c = 0
	if n % 2 != 0:
		for i in range(len(x)):
			if i % 2 == 0:
				lst.append(x[i])
			else:
				lst1.append(x[i])
		c = abs(lst[len(lst) // 2] - lst1[len(lst1) // 2])
		print(c)
	else:
		for i in range(len(x) - 1):
			if i % 2 == 0:
				lst.append(x[i])
			else:
				lst1.append(x[i])
		lst.append(x[len(x) - 1])
		c = abs(lst[len(lst) // 2] - lst1[len(lst1) // 2])
		print(c)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	alist = list(map(int, stdin.readline().split()))
	alist.sort()
	stdout.write('{}\n'.format(alist[n] - alist[n - 1]))


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(mapi())
	a.sort()
	e = []
	d = []
	one = a[n - 1]
	two = a[n]
	print(abs(two - one))


t = int(input())
for tt in range(t):
	n = int(input())
	nums = [int(i) for i in input().split()]
	nums.sort()
	div = int(nums[n]) - int(nums[n - 1])
	print(div)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	z = []
	x = l[1:]
	t = l[0]
	for i in range(2 * n - 1):
		z.append(abs(t - x[len(x) // 2]))
		(t, x[i]) = (x[i], t)
	print(min(z))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = sorted(array())
	print(a[n] - a[n - 1])


def main():
	for _ in range(int(input())):
		n = int(input())
		a = sorted(list(map(int, input().split())))
		print(a[n] - a[n - 1])
main()


t = int(input())
for _ in range(t):
	n = int(input())
	n = 2 * n
	arr = list(map(int, input().split()))
	arr.sort()
	result = arr[int((n - 1) / 2) + 1] - arr[int((n - 1) / 2)]
	print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	(A, B) = ([], [])
	for i in range(0, len(a), 2):
		A.append(a[i])
		B.append(a[i + 1])
	if len(A) % 2 == 0:
		A.append(B.pop())
	print(abs(A[len(A) // 2] - B[len(B) // 2]))


def func(arr: list) -> int:
	arr.sort()
	n = len(arr)
	return arr[n // 2] - arr[n // 2 - 1]

def start():
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = []
		arr = list(map(int, input().split(' ')))
		print(func(arr))
start()


t = int(input())
for case in range(t):
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	print(arr[n] - arr[n - 1])


num_cases = int(input())
for _ in range(num_cases):
	halved = int(input())
	nums = sorted(list(map(int, input().split(' '))))
	print(nums[halved] - nums[halved - 1])


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	s = [int(x) for x in input().split()]
	s = sorted(s)
	print(abs(s[n] - s[n - 1]))


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def RL():
	return map(int, stdin.readline().rstrip().split())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
N = int(input())
for _ in range(N):
	hv = int(input())
	arr = list(RL())
	le = len(arr)
	arr.sort()
	print(abs(arr[le // 2] - arr[le // 2 - 1]))


import statistics
t = int(input())
for i in range(t):
	n = int(input())
	z = map(int, input().split())
	a = list(z)
	a.sort()
	n = []
	m = []
	if len(a) / 2 % 2 == 0:
		x = a.pop()
		for i in range(0, len(a)):
			if i % 2 == 0:
				m.append(a[i])
			else:
				n.append(a[i])
		m.append(x)
	else:
		for i in range(0, len(a)):
			if i % 2 == 0:
				m.append(a[i])
			else:
				n.append(a[i])
	m.sort()
	n.sort()
	if statistics.median(m) > statistics.median(n):
		print(statistics.median(m) - statistics.median(n))
	else:
		print(statistics.median(n) - statistics.median(m))


t = int(input())
for tests in range(t):
	n = int(input())
	a_i = sorted([int(a) for a in input().split()])
	print(a_i[n] - a_i[n - 1])


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	arr.sort()
	print(abs(arr[n] - arr[n - 1]))
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	size = int(input())
	skills = sorted([int(i) for i in input().split()])
	print(skills[size] - skills[size - 1])


alph = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	arr.sort()
	ans = float('inf')
	for i in range(n):
		ans = min(ans, abs(arr[i] - arr[n]))
	for i in range(n, 2 * n):
		ans = min(ans, abs(arr[i] - arr[n - 1]))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	arr.sort()
	mid = len(arr) // 2
	print(abs(arr[mid - 1] - arr[mid]))


for t in range(int(input())):
	l = int(input())
	a = list(map(int, input().split()))
	a.sort()
	cA = 0
	A = []
	cB = 0
	B = []
	for i in range(2 * l):
		if cA > cB:
			cB += a[i]
			B.append(a[i])
		else:
			cA += a[i]
			A.append(a[i])
	if len(A) % 2 == 0:
		if len(A) < len(B):
			A.append(B[0])
			B.pop(0)
		else:
			B.append(B[0])
			A.pop(0)
	A.sort()
	B.sort()
	print(abs(A[len(A) // 2] - B[len(B) // 2]))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	v = sorted(list(map(int, stdin.readline().rstrip().split())))
	mid1 = v[n]
	mid2 = v[n - 1]
	print(abs(mid1 - mid2))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		print(a[n] - a[n - 1])
	return
main()


def solution(l):
	ans = []
	for i in range(len(l)):
		a = l[i]
		a.sort()
		k = len(a) // 2
		j = a[k] - a[k - 1]
		ans.append(j)
	return ans

def main():
	t = int(input())
	l = []
	for i in range(0, t):
		n = int(input())
		a = list(map(int, input().split()))
		l.append(a)
	ans = solution(l)
	for i in range(len(ans)):
		print(ans[i])
main()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		array = sorted([int(x) for x in input().strip().split()])
		min_diff = 1000 * 1000 * 10000
		begin = n // 2
		while begin >= 0:
			min_diff = min(min_diff, abs(array[n - 1 - begin] - array[n + begin]))
			begin -= 1
		print(min_diff)
main()


for i in range(int(input())):
	k = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(abs(l[len(l) // 2] - l[(len(l) - 1) // 2]))


import collections, heapq

def main():
	T = int(input().strip())
	for _ in range(T):
		n = int(input().strip())
		a = [int(x) for x in input().strip().split(' ')]
		a.sort()
		print(a[n] - a[n - 1])
main()


t = int(input())
while t > 0:
	n = int(input())
	l = [int(a) for a in input().split(' ', 2 * n - 1)]
	l.sort()
	print(l[n] - l[n - 1])
	t -= 1


for n in range(int(input())):
	x = int(input())
	s = sorted(list(map(int, input().split())))
	s = [0] + s
	if x == 1:
		print(s[2] - s[1])
		continue
	print(s[x + 1] - s[x])


for case in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = n // 2
	x = x - 1
	a.sort()
	diff = a[n] - a[n - 1]
	print(abs(diff))


def b():
	t = int(input())
	for i in range(t):
		n = int(input())
		l = [int(x) for x in input().split()]
		print(solveb(n, l))

def solveb(n, l=None):
	if l is None:
		return 0
	l.sort()
	return abs(l[n] - l[n - 1])
b()


for _ in range(int(input())):
	n = int(input())
	x = 0
	a = [int(i) for i in input().split()]
	a = sorted(a)
	x = abs(a[n - 1] - a[n])
	print(x)


n = int(input())
import bisect

def f(arr):
	arr.sort()
	part1 = []
	part2 = []
	if len(arr) % 4 == 0:
		part1 = [arr[0], arr[1]]
		for i in range(2, len(arr), 2):
			part2.append(arr[i])
			part1.append(arr[i + 1])
	else:
		for i in range(0, len(arr), 2):
			part1.append(arr[i])
			part2.append(arr[i + 1])
	m1 = part1[len(part1) // 2]
	m2 = part2[len(part2) // 2]
	return abs(m1 - m2)
for _ in range(n):
	input()
	arr = list(map(int, input().split()))
	print(f(arr))


t = int(input())
t1 = 0
while t1 < t:
	n = int(input())
	x = []
	x = list(map(int, input().split()))[:2 * n]
	x.sort()
	print(x[n] - x[n - 1])
	t1 = t1 + 1


import sys
from functools import reduce

def solution(arr, n):
	arr.sort()
	res = float('inf')
	for i in range(n):
		res = min(res, arr[n] - arr[i])
	for i in range(n, 2 * n):
		prev = res
		res = min(res, arr[i] - arr[n - 1])
		if res > prev:
			break
	print(res)
for line in sys.stdin:
	t = int(line)
	break
p = 1
for line in sys.stdin:
	if p == 1:
		n = int(line)
	else:
		arr = [int(x) for x in line.split()]
		solution(arr, n)
	p *= -1


t = int(input())
for i in range(t):
	n = int(input())
	array = list(map(int, input().split(' ')))
	array = sorted(array)
	print(array[n] - array[n - 1])


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		A.sort()
		print(A[N] - A[N - 1])
main()


t = int(input())
for _ in range(t):
	n = int(input())
	skills = list(map(int, input().split()))
	skills.sort()
	print(skills[n] - skills[n - 1])


from sys import stdin
testcase = True
if testcase:
	t = int(stdin.readline())
	while t:
		n = int(stdin.readline())
		a = list(map(int, stdin.readline().split()))
		a.sort()
		ans = a[n] - a[n - 1]
		print(ans)
		t -= 1
else:
	n = int(stdin.readline())
	(p, m) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(abs(a[n] - a[n - 1]))


t = int(input())
for _ in range(t):
	n = int(input())
	students = sorted([int(r) for r in input().split()], reverse=True)
	print(abs(students[len(students) // 2 - 1] - students[len(students) // 2]))


def bisect(arr, val, cmp):
	l = -1
	r = len(arr)
	while r - l > 1:
		e = l + r >> 1
		if cmp(arr[e], val):
			l = e
		else:
			r = e
	return r
t = int(input())
answers = []
for ti in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	answers.append(abs(arr[n] - arr[n - 1]))
for a in answers:
	print(a)


t = int(input())
for bla in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	lis = sorted(lis)
	print(lis[n] - lis[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	m = 2 * n
	arr = list(map(int, input().split()))[:m]
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


__author__ = 'tanunia'
t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	(x, y) = (len(a) // 2, len(a) // 2 - 1)
	print(abs(a[x] - a[y]))


T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split(' ')))
	A.sort()
	print(A[N] - A[N - 1])


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	n = ii()
	a = sorted(li())
	print(abs(a[n] - a[n - 1]))


a = int(input())
for _ in range(a):
	x = int(input())
	li = list(map(int, input().split()))
	li.sort()
	print(li[x] - li[x - 1])


cc = int(input())
while cc > 0:
	cc -= 1
	ll = int(input())
	(*aa,) = map(int, input().split())
	aa.sort()
	print(aa[ll] - aa[ll - 1])


for i in range(int(input())):
	k = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = len(a) // 2
	print(a[b] - a[b - 1])


def examA():
	t = I()
	ans = []
	for _ in range(t):
		n = I()
		A = LI()
		cur = 0
		for a in A:
			if a == 0:
				cur += 1
		if cur + sum(A) == 0:
			cur += 1
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examB():
	ans = []
	t = I()
	for _ in range(t):
		N = I()
		A = LI()
		A.sort()
		cur = A[N] - A[N - 1]
		ans.append(cur)
	for v in ans:
		print(v)
	return

def examC():
	ans = 0
	print(ans)
	return

def examD():
	ans = 0
	print(ans)
	return

def examE():
	ans = 0
	print(ans)
	return

def examF():
	ans = 0
	print(ans)
	return
import sys, copy, bisect, itertools, heapq, math, random
from heapq import heappop, heappush, heapify
from collections import Counter, defaultdict, deque

def I():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LSI():
	return list(map(str, sys.stdin.readline().split()))

def LS():
	return sys.stdin.readline().split()

def SI():
	return sys.stdin.readline().strip()
global mod, mod2, inf, alphabet, _ep
mod = 10 ** 9 + 7
mod2 = 998244353
inf = 10 ** 18
_ep = 10 ** (-12)
alphabet = [chr(ord('a') + i) for i in range(26)]
examB()


result = str()
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	local_result = abs(a[n - 1] - a[n])
	result += f'\n{local_result}'
print(result.strip())


t = int(input())
for tc in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	m = a[n] - a[n - 1]
	print(m)


n = int(input())
for i in range(n):
	s = int(input())
	l = sorted(list(map(int, input().split())))
	print(l[s] - l[s - 1])


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = str(input())
	duml = l.split()
	l = []
	for i in duml:
		i = int(i)
		l.append(i)
	l.sort(reverse=True)
	d1 = l[n - 1]
	d2 = l[n]
	res = d1 - d2
	print(res)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	if n == 1:
		print(a[1] - a[0])
		continue
	(x, y, z) = (a[n - 2], a[n - 1], a[n])
	print(min(z - x, z - y))


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	if n == 1:
		print(l[n] - l[n - 1])
	else:
		print(l[n] - l[n - 1])
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	a = max(l[0:n])
	b = min(l[n:])
	print(b - a)


for _ in range(int(input())):
	me = int(input())
	you = list(map(int, input().split()))
	you.sort()
	print(you[me] - you[me - 1])


N = int(input())
for _ in range(N):
	x = int(input())
	a = sorted(list(map(int, input().split())))
	print(abs(a[x] - a[x - 1]))


n_samples = input()
a = []
for j in range(int(n_samples)):
	n_05 = input()
	a.append(list(map(int, input().split(' '))))
for cl in a:
	cl.sort()
	print(abs(cl[len(cl) // 2 - 1] - cl[len(cl) // 2]))


read = lambda : list(map(int, input().split(' ')))
t = int(input())
for i in range(t):
	n = int(input())
	arr = read()
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))


t = int(input())
for _ in range(t):
	len_half = int(input())
	students = [int(i) for i in input().split()]
	students = sorted(students)
	print(students[len_half] - students[len_half - 1])


for jk in range(int(input())):
	q = int(input())
	numArray = [int(x) for x in input().split()]
	numArray.sort()
	print(numArray[q] - numArray[q - 1])


T = int(input())
for i in range(T):
	half_numof_numbers = int(input())
	numbers = input().split()
	numbers = list(map(lambda x: int(x), numbers))
	numbers = sorted(numbers)
	a = numbers[half_numof_numbers]
	b = numbers[half_numof_numbers - 1]
	print(a - b)


t = int(input())
a = []
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	a.append([n, b])
for i in a:
	n = i[0]
	j = i[1]
	j.sort()
	print(j[n] - j[n - 1])


t = int(input())
for g in range(t):
	n = int(input())
	q = sorted((int(f) for f in input().split()))
	if n % 2:
		print(q[n] - q[n - 1])
	else:
		print(q[n] - q[n - 1])


from collections import defaultdict
from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	print(a[n] - a[n - 1])


N = int(input())
for _ in range(N):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	copy = lst
	a = lst[n]
	b = lst[n - 1]
	print(abs(a - b))


from math import sqrt
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	if n == 1:
		ans.append(abs(a[0] - a[1]))
		continue
	a1 = []
	a2 = []
	f = True
	for i in a:
		if f:
			f = not f
			a1.append(i)
		else:
			f = not f
			a2.append(i)
	if n % 2 == 0:
		a1.append(a2[len(a2) - 1])
		a2 = a2[:len(a2) - 1]
	ans.append(abs(a1[int((len(a1) - 1) / 2)] - a2[int((len(a2) - 1) / 2)]))
for i in ans:
	print(i)


te = int(input())
while te > 0:
	te -= 1
	n = int(input())
	skills = list(map(int, input().split()))
	skills.sort()
	ans = abs(skills[n] - skills[n - 1])
	print(ans)


from math import *

def median(arr):
	sorted_arr = sorted(arr)
	return sorted_arr[len(sorted_arr) // 2]

def func(arr):
	n = len(arr) // 2
	arr.sort()
	(a, b) = (arr[n - 1], arr[n])
	return b - a
t = int(input())
arr_levels = []
for _ in range(t):
	halved = int(input())
	s = input()
	s = s.split()
	tmp_arr = []
	for el in s:
		tmp_arr.append(int(el))
	arr_levels.append(tmp_arr)
for i in range(t):
	print(func(arr_levels[i]))


for _ in range(int(input())):
	k = int(input())
	ls = sorted(list(map(int, input().split())))
	print(abs(ls[len(ls) // 2 - 1] - ls[len(ls) // 2]))


number = int(input())
for _ in range(number):
	x = int(input())
	all_list = sorted([int(y) for y in input().split()])
	print(abs(all_list[x] - all_list[x - 1]))


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s.sort()
	a = s[int(len(s) / 2)]
	s.pop(int(len(s) / 2))
	b = s[int(len(s) / 2)]
	print(a - b)


t = int(input())
for i in range(t):
	n = int(input())
	stu = [int(i) for i in input().split()]
	stu.sort()
	print(stu[2 * n // 2] - stu[2 * n // 2 - 1])


def module(n, lst):
	return abs(lst[n] - lst[n - 1])
for _ in range(int(input())):
	m = int(input())
	a = [int(i) for i in input().split()]
	print(module(m, sorted(a)))


t = int(input())
for q in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	print(arr[n] - arr[n - 1])


input = __import__('sys').stdin.readline
MIS = lambda : map(int, input().split())
for TEST in range(int(input())):
	n = int(input())
	arr = sorted(MIS())
	print(abs(arr[n - 1] - arr[n]))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	l = []
	r = []
	if n % 2 != 0:
		for j in range(len(a)):
			if j % 2 == 0:
				l.append(a[j])
			else:
				r.append(a[j])
		print(abs(l[n // 2] - r[n // 2]))
	else:
		for j in range(len(a) - 1):
			if j % 2 == 0:
				l.append(a[j])
			else:
				r.append(a[j])
		l.append(a[len(a) - 1])
		print(abs(l[len(l) // 2] - r[len(r) // 2]))


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	n = I()
	a = LI()
	a = sorted(a)
	print(abs(a[n] - a[n - 1]))

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


for i in [0] * int(input()):
	a = int(input()) * 2 - 1
	l = sorted(map(int, input().split()))
	print(l[0 - -a // 2] - l[a // 2])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	k2 = (n - 1) // 2
	m2 = n - k2 - 1
	k = 2 * k2 + 1
	m = 2 * m2 + 1
	m1 = []
	k1 = []
	for i in range(max(k, m)):
		if i * 2 < len(a):
			m1.append(a[2 * i])
	for i in range(min(k, m)):
		if 2 * i + 1 < len(a):
			k1.append(a[2 * i + 1])
	print(abs(m1[len(m1) // 2] - k1[len(k1) // 2]))


n = int(input())
for _ in range(n):
	a = int(input())
	L = input().split()
	L2 = []
	for i in range(2 * a):
		x = int(L[i])
		L2.append(x)
	L2.sort()
	if L2[a - 1] - L2[a] < 0:
		print(L2[a] - L2[a - 1])
	else:
		print(L2[a - 1] - L2[a])


cases = int(input())
for i in range(cases):
	line1 = int(input())
	line2 = input().split(' ')
	arr = []
	for a in line2:
		arr.append(int(a))
	if len(arr) == 2:
		print(abs(arr[1] - arr[0]))
		continue
	arr.sort()
	midleft = int(len(arr) / 2) - 1
	midright = int(len(arr) / 2)
	med1 = arr[midleft]
	med2 = arr[midright]
	print(abs(med1 - med2))


from sys import stdin
input = stdin.buffer.readline
t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	print(abs(arr[n] - arr[n - 1]))


tc = int(input())
for t in range(0, tc):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.sort()
	print(a[n] - a[n - 1])


from sys import stdin
r = stdin.readline

def read_list():
	return list(map(int, r().strip().split()))

def median(A):
	n = len(A)
	if n % 2 == 1:
		return A[n // 2]
	else:
		return (A[n // 2] + A[n // 2 - 1]) // 2

def solve(A, mid):
	A.sort()
	return A[mid] - A[mid - 1]

def main():
	cases = int(r())
	for case in range(cases):
		n = int(r())
		A = read_list()
		print(solve(A, n))
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	m = 2 * n
	x = abs(arr[n - 1] - arr[n])
	print(x)


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	a = sorted(a)
	d = len(a)
	print(a[d // 2] - a[d // 2 - 1])


t = int(input())
for _ in range(t):
	n = int(input())
	ar = [int(x) for x in input().split()]
	ar.sort()
	ar1 = []
	a = 0
	b = 1
	while b < 2 * n:
		ar1.append(ar[b] - ar[a])
		a += 1
		b += 1
	print(ar1[(2 * n - 1) // 2])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	l_arr = arr[:n]
	r_arr = arr[n:]
	x = abs(l_arr[-1] - r_arr[0])
	print(x)


TC = int(input())

def solve(arr):
	n = len(arr)
	arr.sort()
	return arr[n // 2] - arr[n // 2 - 1]
for _ in range(TC):
	n = int(input())
	(*arr,) = map(int, input().split())
	print(solve(arr))


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	print(abs(arr[n - 1] - arr[n]))
	t -= 1


import math
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(c) for c in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


from sys import stdin
input = stdin.readline
for xoxo in range(1):
	a = []
	for _ in range(int(input())):
		n = int(input())
		ans = 0
		a = list(map(int, input().split()))
		a.sort()
		print(a[n] - a[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	q1 = []
	q2 = []
	for i in range(len(a)):
		if len(q1) == len(q2):
			q1.append(a[i])
		elif len(q1) > len(q2):
			q2.append(a[i])
		else:
			q1.append(a[i])
	if len(q1) % 2 == 0 or len(q2) % 2 == 0:
		if q1[len(q1) // 2] > q2[len(q2) // 2]:
			q2.append(q1.pop())
		else:
			q1.append(q2.pop())
	print(abs(q1[len(q1) // 2] - q2[len(q2) // 2]))


for _ in range(int(input())):
	n = int(input())
	a = [int(__) for __ in input().split()]
	a.sort()
	print(a[n] - a[n - 1])


t = int(input())
for _ in range(t):
	n = 0
	n = int(input())
	li = list(map(int, input().split()))
	li.sort()
	print(li[n] - li[n - 1])


from os import path
import sys
from collections import defaultdict, Counter
maxx = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
else:
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
for _ in range(I()):
	n = I()
	ls = lint()
	ls.sort()
	print(ls[n] - ls[n - 1])


def assign(arr):
	mid = len(arr) // 2
	arr.sort()
	diff = abs(arr[mid] - arr[mid - 1])
	return diff
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	print(assign(arr))


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	n = int(fastinput())
	a = list(map(int, fastinput().split()))
	a.sort()
	print(a[n] - a[n - 1])


def main():
	_ = int(input())
	for i in range(_):
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		print(abs(a[n - 1] - a[n]))
main()


for i in range(int(input())):
	n = int(input())
	lis = [x for x in map(int, input().split())]
	lis = sorted(lis)
	print(lis[n] - lis[n - 1])


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	print(l[n] - l[n - 1])


import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
q = I()
for _ in range(q):
	n = I()
	A = readInts()
	A = sorted(A)
	n = 2 * n
	print(A[n // 2] - A[n // 2 - 1])


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	n = 2 * n
	print(abs(a[n // 2 - 1] - a[n // 2]))


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.sort()
	if n > 1:
		print(min(arr[n + 1] - arr[n - 1], arr[n] - arr[n - 1]))
	else:
		print(arr[-1] - arr[0])


for _ in range(int(input())):
	n = int(input())
	ls = [int(x) for x in input().split()]
	ls.sort()
	print(ls[n] - ls[n - 1])


for _ in range(int(input())):
	v = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[v] - a[v - 1])


import sys
import math
import bisect

def main():
	for _ in range(int(input())):
		n = int(input())
		A = list(map(int, input().split()))
		A.sort()
		ans = A[n] - A[n - 1]
		print(ans)
main()


def _listinput():
	return list(map(int, input().split(' ')))

def _input():
	return int(input())

def main():
	answer = ''
	for test in range(_input()):
		n = _input()
		ints = _listinput()
		ints.sort()
		mindiff = abs(ints[n] - ints[n - 1])
		answer += str(mindiff) + '\n'
		pass
	print(answer)
main()


import sys
r_input = sys.stdin.readline
for _ in range(int(r_input())):
	n = int(r_input())
	A = sorted(map(int, r_input().split()))
	print(A[n] - A[n - 1])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	if n == 1:
		print(arr[1] - arr[0])
	else:
		print(arr[n] - arr[n - 1])


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr.sort()
	ans = arr[len(arr) // 2] - arr[len(arr) // 2 - 1]
	print(ans)
	t -= 1


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def c(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def main():
	l = int(input())
	n = 2 * l
	arr = array()
	arr.sort()
	m = INF
	j = (n - 1) // 2
	for i in range(n):
		if i <= j:
			item = arr[j + 1]
		else:
			item = arr[j]
		if abs(item - arr[i]) < m:
			m = abs(item - arr[i])
	print(m)
t = int(input())
for _ in range(t):
	main()


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	first = arr[n - 1]
	second = arr[n]
	print(second - first)
	t = t - 1


t = int(input())
for q in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	if n == 1:
		print(abs(a[0] - a[1]))
		continue
	firstC = []
	secondC = []
	for i in range(2 * n):
		if (i + 1) % 2 == 0:
			secondC.append(a[i])
		else:
			firstC.append(a[i])
	ans = 0
	if len(secondC) % 2 == 0 or len(firstC) % 2 == 0:
		sc = list(secondC)
		fc = list(firstC)
		num1 = secondC[len(secondC) - 1]
		sc.remove(sc[len(sc) - 1])
		fc.append(num1)
		fc.sort()
		m1 = len(fc) // 2
		m2 = len(sc) // 2
		ans = abs(fc[m1] - sc[m2])
		num2 = firstC[0]
		firstC.remove(firstC[0])
		secondC.append(num2)
		secondC.sort()
		m1 = len(firstC) // 2
		m2 = len(secondC) // 2
		ans = min(ans, abs(firstC[m1] - secondC[m2]))
		print(ans)
	else:
		mid1 = len(firstC) // 2
		mid2 = len(secondC) // 2
		print(abs(firstC[mid1] - secondC[mid2]))


for _ in range(int(input())):
	s = int(input())
	arr = sorted(list(map(int, input().split())))
	print(arr[s] - arr[s - 1])


k = int(input())
for i in range(k):
	n = int(input())
	x = [int(i) for i in input().split(' ')]
	x.sort()
	print(abs(x[n - 1] - x[n]))


sp = lambda : list(map(int, input().split()))
si = lambda : int(input())
TESTCASES = int(input())
result = []
for tc in range(TESTCASES):
	n = si()
	a = sorted(sp())
	result.append(str(a[n] - a[n - 1]))
print('\n'.join(result))


for z in range(int(input())):
	input()
	lst = list(map(int, input().split()))
	lst.sort()
	a = int(len(lst) / 2)
	b = a - 1
	print(lst[a] - lst[b])