for _ in range(int(input())): d = list(map(int, input().split())) print(max(d) - min(d))