n = int(eval(input()))

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

a.sort()

r = 0

c = 0

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

    if i%2 ==0:

        r += a[-i]

        c += 1

        if c == n:

            break

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

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

a.sort()

print((sum(a[n::2])))
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
r = 0
c = 0
for i in range(1, 3 * n):
    if i % 2 == 0:
        r += a[-i]
        c += 1
        if c == n:
            break
print(r)

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((sum(a[n::2])))

-r = 0 -c = 0 -for i in range(1, 3 * n): -    if i % 2 == 0: -        r += a[-i] -        c += 1 -        if c == n: -            break -print(r) +print((sum(a[n::2])))