N = int(eval(input()))

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

A.sort(reverse = True)

alice = bob = 0

for i in range(N):

    if i%2 == 0:

        alice += A.pop(0)

    else:

        bob += A.pop(0)

    

print((alice - bob))
N = int(eval(input()))

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

A.sort(reverse = True)

alice = bob = 0

for i in range(N):

    if i%2 == 0:

        alice += A[i]

    else:

        bob += A[i]

    

print((alice - bob))
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
alice = bob = 0
for i in range(N):
    if i % 2 == 0:
        alice += A.pop(0)
    else:
        bob += A.pop(0)
print((alice - bob))

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
alice = bob = 0
for i in range(N):
    if i % 2 == 0:
        alice += A[i]
    else:
        bob += A[i]
print((alice - bob))

-        alice += A.pop(0) +        alice += A[i] -        bob += A.pop(0) +        bob += A[i]