numbers = [int(input()) for _ in range(9)]
max_num = max(numbers)min_num = min(numbers)
difference = max_num - min_num
print(difference)
numbers = [int(input()) for _ in range(9)]
max_num = max(numbers)
min_num = min(numbers)
difference = max_num - min_num
print(difference)