total_integer = int(eval(input()))

integer = sorted(list(map(int, input().split())))

print((integer[total_integer - 1] - integer[0]))
eval(input())

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

print((max(A) - min(A)))
total_integer = int(eval(input()))
integer = sorted(list(map(int, input().split())))
print((integer[total_integer - 1] - integer[0]))

eval(input())
A = list(map(int, input().split()))
print((max(A) - min(A)))

-total_integer = int(eval(input())) -integer = sorted(list(map(int, input().split()))) -print((integer[total_integer - 1] - integer[0])) +eval(input()) +A = list(map(int, input().split())) +print((max(A) - min(A)))