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

s = []

for i in range(n):

  for p in range(n):

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

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

s = []

for i in range(n):

  for p in range(i):

    s.append(abs(a[i] - a[p]))

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

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

-    for p in range(n): -        s.append(a[i] - a[p]) +    for p in range(i): +        s.append(abs(a[i] - a[p]))