N = int(eval(input()))

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



ans = 0

for j in range(len(A) - 1):

  for k in range(j + 1, len(A)):

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

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

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



ans = max(A) - min(A)

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

N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = max(A) - min(A)
print(ans)

-ans = 0 -for j in range(len(A) - 1): -    for k in range(j + 1, len(A)): -        ans = max(ans, abs(A[j] - A[k])) +ans = max(A) - min(A)