N = int(eval(input()))

A = list(map(int, 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 = list(map(int, input().split()))

print((max(A) - min(A)))
N = int(eval(input()))
A = list(map(int, 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 = list(map(int, input().split()))
print((max(A) - min(A)))

-ans = 0 -for i in range(N): -    for j in range(i, N): -        ans = max(ans, abs(A[i] - A[j])) -print(ans) +print((max(A) - min(A)))