N = int(eval(input()))

kushi = sorted(list(map(int,input().split())))

sum = 0

for i in range(2*N):

    if i % 2 == 0:

        sum += kushi[i]

print(sum)

N = int(eval(input()))

kushi = sorted(list(map(int,input().split())))

sum = 0

for i in range(0,2*N,2):

    sum += kushi[i]

print(sum)

N = int(eval(input()))
kushi = sorted(list(map(int, input().split())))
sum = 0
for i in range(2 * N):
    if i % 2 == 0:
        sum += kushi[i]
print(sum)

N = int(eval(input()))
kushi = sorted(list(map(int, input().split())))
sum = 0
for i in range(0, 2 * N, 2):
    sum += kushi[i]
print(sum)

-for i in range(2 * N): -    if i % 2 == 0: -        sum += kushi[i] +for i in range(0, 2 * N, 2): +    sum += kushi[i]