def solve(): N = int(input()) A = list(map(int,input().split())) A.sort() if N % 2: ans = A[0] for i in range(1,N,2): ans += A[i+1] - A[i] print(max(ans, A[N//2])) else: ans = 0 for i in range(0,N,2): ans += A[i+1] - A[i] print(ans) T = int(input()) for _ in range(T): solve()