N = eval(input())

arr = list(map(int, input().split()))

arr.sort()

sum = 0

for i in range(3*N-2, N-1, -2):

  sum += arr[i]

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

src = list(map(int,input().split()))

src.sort(reverse=True)

print((sum(src[1:2*N+1:2])))

N = eval(input())
arr = list(map(int, input().split()))
arr.sort()
sum = 0
for i in range(3 * N - 2, N - 1, -2):
    sum += arr[i]
print(sum)

N = int(eval(input()))
src = list(map(int, input().split()))
src.sort(reverse=True)
print((sum(src[1 : 2 * N + 1 : 2])))

-N = eval(input()) -arr = list(map(int, input().split())) -arr.sort() -sum = 0 -for i in range(3 * N - 2, N - 1, -2): -    sum += arr[i] -print(sum) +N = int(eval(input())) +src = list(map(int, input().split())) +src.sort(reverse=True) +print((sum(src[1 : 2 * N + 1 : 2])))