import sys if __name__ == "__main__": t = int(input()) result = [] for i in range(t): nums = list(map(int, sys.stdin.readline().strip().split())) nums.sort() a = nums[0] b = nums[1] c = nums[2] total = a+b+c avg = (a + b + c) // 3 res = 0 if total % 3 == 0: res = avg else: res = avg + 1 if a+b < avg: res = (c+1) // 2 result.append(res) for i in range(t): print(result[i])