t = int(input())

for _ in range(t):
    a, b, c = map(int, input().split())

    diff = abs(a - b)

    print(max(diff, c - diff))