n = int(eval(input()))

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

s = []

for i in range(n):

    for j in range(n):

        s.append(a[i]-a[j])

print((max(s)))
n = int(eval(input()))

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

print((max(a)-min(a)))
n = int(eval(input()))
a = list(map(int, input().split()))
s = []
for i in range(n):
    for j in range(n):
        s.append(a[i] - a[j])
print((max(s)))

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

-s = [] -for i in range(n): -    for j in range(n): -        s.append(a[i] - a[j]) -print((max(s))) +print((max(a) - min(a)))