#include<iostream>
#include<algorithm>
using namespace std;
int main(){

    int Q;
    cin>>Q;
    while(Q--){
        int c,a,n;
        cin>>c>>a>>n;
        int ans = 0;
        int x = min(c,min(a,n));
        ans += x;
        c-=x,a-=x,n-=x;
        x = min(c/2,a);
        ans += x;
        c-=x*2,a-=x;
        ans += c/3;
        cout<<ans<<endl;
    }

    return 0;
}