#include <iostream>
#include <utility>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
	int q;
	cin>>q;
	while(q--){
		int c,a,n,ans;
		cin>>c>>a>>n;
		int k=min(c,min(a,n));
		ans=k;
		c-=k;
		a-=k;
		n-=k;
		k=min(c/2,a);
		ans+=k;
		c-=2*k;
		a-=k;
		ans+=c/3;
		cout<<ans<<endl;
	}
	return 0;
}