n = int(eval(input()))

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



a.sort()

print((a[-1] - a[0]))
n = int(eval(input()))

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

maximum = max(a)

minimum = min(a)

print((maximum - minimum))
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((a[-1] - a[0]))

n = int(eval(input()))
a = list(map(int, input().split()))
maximum = max(a)
minimum = min(a)
print((maximum - minimum))

-a.sort() -print((a[-1] - a[0])) +maximum = max(a) +minimum = min(a) +print((maximum - minimum))