t=int(input()) while(t): t-=1 b,s,m=map(int,input().split()) print(b+s-m)