#!/bin/python3 import sys def profit(b, s, c): # Return the fixed profit. for i in range(min(b,s)): k= b-i l=s-i d=c-i if k+l==d: return i if __name__ == "__main__": t = int(input().strip()) for a0 in range(t): b, s, c = input().strip().split(' ') b, s, c = [int(b), int(s), int(c)] result = profit(b, s, c) print(result)