N = int(eval(input()))

A = [int(i) for i in input().split()]

A.sort(reverse=True)

ans = 0

for i in range(N):

	ans += A[2*i+1]

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

A = sorted([int(i) for i in input().split()])

A.reverse()

print((sum(A[1:2*N:2])))
N = int(eval(input()))
A = [int(i) for i in input().split()]
A.sort(reverse=True)
ans = 0
for i in range(N):
    ans += A[2 * i + 1]
print(ans)

N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
A.reverse()
print((sum(A[1 : 2 * N : 2])))

-A = [int(i) for i in input().split()] -A.sort(reverse=True) -ans = 0 -for i in range(N): -    ans += A[2 * i + 1] -print(ans) +A = sorted([int(i) for i in input().split()]) +A.reverse() +print((sum(A[1 : 2 * N : 2])))