n = int(eval(input()))

A = [int(i) for i in input().split()]



ans = -1

for i in range(n):

    for j in range(n):

        temp = abs(A[i] - A[j])

        ans = max(ans, temp)

        

print(ans)
n = int(eval(input()))

A = [int(i) for i in input().split()]



ans = 0

for i in range(n):

    for j in range(i, n):

        ans = max(ans, abs(A[i] - A[j]))

        

print(ans)
n = int(eval(input()))
A = [int(i) for i in input().split()]
ans = -1
for i in range(n):
    for j in range(n):
        temp = abs(A[i] - A[j])
        ans = max(ans, temp)
print(ans)

n = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    for j in range(i, n):
        ans = max(ans, abs(A[i] - A[j]))
print(ans)

-ans = -1 +ans = 0 -    for j in range(n): -        temp = abs(A[i] - A[j]) -        ans = max(ans, temp) +    for j in range(i, n): +        ans = max(ans, abs(A[i] - A[j]))