n = int(eval(input()))

a = sorted(map(int, input().split()))

ans = 0

l = 0

r = 3*n-1

while l < r:

    ans += a[r-1]

    l += 1

    r -= 2

    # print(l, r)



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

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

ans = 0

a.sort(reverse=True)

for i in range(n):

    ans += a[2*i+1]



print(ans)
n = int(eval(input()))
a = sorted(map(int, input().split()))
ans = 0
l = 0
r = 3 * n - 1
while l < r:
    ans += a[r - 1]
    l += 1
    r -= 2
    # print(l, r)
print(ans)

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

-a = sorted(map(int, input().split())) +a = list(map(int, input().split())) -l = 0 -r = 3 * n - 1 -while l < r: -    ans += a[r - 1] -    l += 1 -    r -= 2 -    # print(l, r) +a.sort(reverse=True) +for i in range(n): +    ans += a[2 * i + 1]