// 吃葡萄
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;
    vector<int> grape(3);
    usigned ll sum, ans;
    cin >> t;
    while(t--){
        for(int i = 0; i < 3; i++)
            cin >> grape[i];
        sum = grape[0] + grape[1] + grape[2];
        sort(grape.begin(), grape.end());
        if(grape[0] + grape[1] >= grape[2]/2){
            if(sum % 3)
                ans = sum / 3 + 1;
            else
                ans = sum;
        }else{
            if(grape[2] % 2)
                ans = grape[2] / 2;
            else
                ans = grape[2] / 2 + 1;
        }
        cout << ans << endl;
    }
}