Chef and Roma are playing a game. Rules of the game are quite simple.
Initially there are N piles of stones on the table.
In each turn, a player can choose one pile and remove it from the table.
Each player want to maximize the total number of stones removed by him.
Chef takes the first turn. 

Please tell Chef the maximum number of stones he can remove assuming that both players play optimally.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N denoting the number of piles.
The second line contains N space separated integers A1, A2, ..., AN denoting the number of stones in each pile.

-----Output-----
For each test case, output a single line containg the maximum number of stones that Chef can remove.

-----Constraints-----
- 1 ≤ Ai ≤ 109
- Subtask 1 (35 points): T = 10, 1 ≤ N ≤ 1000
- Subtask 2 (65 points): T = 10, 1 ≤ N ≤ 105 

-----Example-----
Input:
2
3
1 2 3
3
1 2 1

Output:
4
3

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for i in range(int(input())):
 n = int(input())
 l = list(map(int,input().split()))
 s = 0
 l.sort(reverse = True)
 for i in range(0,n,2):
  s = s+l[i]
 print(s)


# cook your dish here
test_case = int(input())
while test_case :
 n = int(input())
 array = list(map(int, input().strip().split()))
 
 array.sort(reverse = True)
 i = 0 
 s = 0 
 while(i < n) :
  s += array[i]
  i += 2 
 print(s)
 test_case -= 1
 
 
 
 
 
 
 
 
 
 


t=int(input())
while t:
 n=int(input())
 a=list(map(int,input().split()))
 c=0
 a.sort(reverse=True)
 for i in range(0,len(a),2):
  c+=a[i]
 print(c)
 t-=1

# cook your dish here
t=int(input())
while t:
 t=t-1
 n=int(input())
 l=list(map(int,input().split()))
 l.sort(reverse=True)
 c=0
 for i in range(0,n,2):
  c+=l[i]
 print(c)

# cook your dish here
t=int(input())
for i in range(t):
 ans=0
 n=int(input())
 a=[int(x) for x in input().split()]
 lis=sorted(a,reverse=True)
 for val in range(0,len(lis),2):
  # print(val)
  ans=ans+lis[val]
 print(ans)

for t in range(int(input())):
 n=int(input())
 a=sorted(list(map(int, input().split())),reverse=True)
 print(sum(a[::2]))

# cook your dish here
t=int(input())
for _ in range(t):
 n=int(input())
 s=list(map(int,input().split()))
 
 s.sort(reverse=True)
 cnt=0
 
 for i in range(0,n,2):
  cnt += s[i]
  
 print(cnt)

# cook your dish here
import math
t=int(input())
for _ in range(t):
 n=int(input())
 l=list(map(int,input().split()))
 l.sort(reverse=True)
 p=0
 for i in range(0,n,2):
  p+=l[i]
 print(p)


for _ in range(int(input())):
 n=int(input())
 ar=[int(x) for x in input().split()]
 ar.sort(reverse=True)
 s=0
 for i in range(0,n,2):
  s+=ar[i]
 print(s)


for i in range(int(input())):
 m=int(input())
 lst=list(map(int,input().split()))
 l=max(lst)
 lst.sort()
 count=0
 for i in range(m-1,-1,-2):
  count += lst[i]
 print(count)

for _ in range(int(input())):
 n = int(input())
 a = list(map(int, input().split()))
 ans = 0
 while a:
  try:
   ans += max(a)
   # pos = a.index(max(a))
   a.remove(max(a))
   a.remove(max(a))
  except:
   break
 print(ans)


# cook your dish here
T = int(input())
for j in range(T):
 n = int(input())
 a = list(map(int, input().split()))
 a.sort(reverse=True)
 print(sum(a[::2]))

# cook your dish here
for _ in range(int(input())):
 n = int(input())
 arr = list(map(int, input().split()))
 arr.sort()
 count = 0
 for i in range(n-1,-1,-2):
  count += arr[i]
 print(count) 


# cook your dish here
for _ in range(int(input())):
 n = int(input())
 arr = list(map(int,input().split()))
 count = 0
 arr.sort()
 for i in range(n-1,-1,-2):
  count += arr[i]
 print(count)

# cook your dish here
for _ in range(int(input())):
 n = int(input())
 lis = list(map(int,input().split()))
 lis.sort()
 chef = sum([lis[i] for i in range(0,n,2)])
 other = sum(lis[i] for i in range(1,n,2))
 print(max(chef,other))

for _ in range(int(input())):
 n = int(input())
 array = [int(i) for i in input().split()]
 array.sort()

 stones1 = sum([array[i] for i in range(0, n, 2)])
 stones2 = sum([array[i] for i in range(1, n, 2)])
 print(max(stones2, stones1)) 

T = int(input())
ans = []

for _ in range(T):
 N = int(input())
 A = [int(i) for i in input().split()]

 A.sort(reverse=True)
 count = 0
 for i in range(0,N,2):
  count += A[i]
 ans.append(count)

for i in ans:
 print(i)


# cook your dish here
for t in range(int(input())):

 N = int(input())
 arr = list(map(int, input().split()))
 arr.sort(reverse=True)

 count = 0

 for i in range(0, len(arr), 2):
  count += arr[i]

 print(count)


# cook your dish here
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 17:24:15 2020

@author: Admin
"""

for _ in range(int(input())):
 n=int(input())
 l=[int(i) for i in input().split()]
 g=sorted(l,reverse=True)
 s=0
 for r in range(0,len(l),2):
  s+=g[r]
 print(s)

t = int(input())
while t > 0:
 n = int(input())
 li = [int(x) for x in input().split()]
 li.sort(reverse=True)
 c = 0
 for i in range(n):
  if i % 2 == 0:
   c += li[i]
 print(c)
 t = t - 1


# cook your dish here
t=int(input().strip())
for _ in range(t):
 n = int(input().strip())
 a = list(map(int,input().strip().split(" ")))
 a.sort(reverse=True)
 ans = 0
 for i in range(0,n,2):
  ans += a[i]
 print(ans)

t=int(input())
for i in range(t):
 n=int(input())
 l=sorted(map(int, input().split()), reverse=True)
 print(sum(l[::2]))


from sys import stdin
def main():
 n = int(stdin.readline())
 ls = [int(x) for x in stdin.readline().split()]
 ls = sorted(ls,reverse=True)
 s =0
 for i in range(0,n,2):
  s+= ls[i]
 print(s)
def __starting_point():
 for _ in range(int(stdin.readline())):
  main()

__starting_point()