import sys input = sys.stdin.readline T=int(input()) for tests in range(T): A=list(map(int,input().split())) ANS=max(A)-min(A) print(ANS)