N = int(eval(input()))

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

a.sort()



ans = 0

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

    ans += a[i]



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

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

a.sort()



# ans = 0

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

#     ans += a[i]



# print (ans)



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

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

-ans = 0 -for i in range(N, 3 * N, 2): -    ans += a[i] -print(ans) +# ans = 0 +# for i in range(N, 3 * N, 2): +#     ans += a[i] +# print (ans) +print((sum(a[N::2])))