n = int(eval(input()))

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

print((lst[-1]-lst[0]))

n = eval(input())

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

print((max(lst)-min(lst)))

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

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

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