eval(input())

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

print((max(a)-min(a)))
eval(input())

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

print((a[-1]-a[0]))
eval(input())
a = list(map(int, input().split()))
print((max(a) - min(a)))

eval(input())
a = sorted(map(int, input().split()))
print((a[-1] - a[0]))

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