N = int(eval(input()))

ans = 0

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

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()))

ans = 0

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

A.sort()

print((A[-1]-A[0]))
N = int(eval(input()))
ans = 0
A = list(map(int, input().split()))
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()))
ans = 0
A = list(map(int, input().split()))
A.sort()
print((A[-1] - A[0]))

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