n = int(eval(input()))

a = sorted(list(map(int, input().split())), reverse=True)



ans = 0



for i in range(1, 2*n, 2):

    ans += a[i]



print(ans)
n = int(eval(input()))

A = sorted(list(map(int, input().split())), reverse=True)



#print(A)

ans = 0

for i in range(1, 2*n+1, 2):

  ans += A[i]

print(ans)
n = int(eval(input()))
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(1, 2 * n, 2):
    ans += a[i]
print(ans)

n = int(eval(input()))
A = sorted(list(map(int, input().split())), reverse=True)
# print(A)
ans = 0
for i in range(1, 2 * n + 1, 2):
    ans += A[i]
print(ans)

-a = sorted(list(map(int, input().split())), reverse=True) +A = sorted(list(map(int, input().split())), reverse=True) +# print(A) -for i in range(1, 2 * n, 2): -    ans += a[i] +for i in range(1, 2 * n + 1, 2): +    ans += A[i]