for i in xrange(int(raw_input())): order = map(int,raw_input().split()) f = order[0]+order[1]-order[2] print f