------
## 最终结论
```python
def max_days_eating_candies(t, test_cases):
    results = []
    for i in range(t):
        r, g, b = sorted(test_cases[i])
        # The maximum days Tanya can eat candies
        max_days = min((r + g + b) // 2, r + g)
        results.append(max_days)
    return results

# Input reading
t = int(input())
test_cases = [tuple(map(int, input().split())) for _ in range(t)]

# Get the results
results = max_days_eating_candies(t, test_cases)

# Output the results
for result in results:
    print(result)
```