count=eval(input())

list=input().rstrip().split(" ")

list_1=[int(s) for s in list]

list2= sorted(list_1)

sa=(list2[0]-list2[int(count)-1])

if sa<0:

  print((-1*sa))

else:

  print(sa)
count=eval(input())

list=input().rstrip().split(" ")

list_1=[int(s) for s in list]

list2= sorted(list_1)

sa=(max(list2)-min(list2))

if sa<0:

  print((-1*sa))

else:

  print(sa)
count = eval(input())
list = input().rstrip().split(" ")
list_1 = [int(s) for s in list]
list2 = sorted(list_1)
sa = list2[0] - list2[int(count) - 1]
if sa < 0:
    print((-1 * sa))
else:
    print(sa)

count = eval(input())
list = input().rstrip().split(" ")
list_1 = [int(s) for s in list]
list2 = sorted(list_1)
sa = max(list2) - min(list2)
if sa < 0:
    print((-1 * sa))
else:
    print(sa)

-sa = list2[0] - list2[int(count) - 1] +sa = max(list2) - min(list2)