t = int(input()) while t: t -= 1 a = list(map(int, input().split())) print(max(a)-min(a))