N = eval(input())

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

print((max(a)-min(a)))
total_house = int(eval(input()))

house_coordinate = sorted(list(map(int, input().split())))

print((house_coordinate[total_house - 1]- house_coordinate[0]))
N = eval(input())
a = list(map(int, input().split()))
print((max(a) - min(a)))

total_house = int(eval(input()))
house_coordinate = sorted(list(map(int, input().split())))
print((house_coordinate[total_house - 1] - house_coordinate[0]))

-N = eval(input()) -a = list(map(int, input().split())) -print((max(a) - min(a))) +total_house = int(eval(input())) +house_coordinate = sorted(list(map(int, input().split()))) +print((house_coordinate[total_house - 1] - house_coordinate[0]))