#include<iostream>
#include<string>
#include<cstdio>

using namespace std;

int main(){
	int q;
	int c,a,n;
	int ans;
	int team;
	int flagc,flaga;
	cin >> q;
	while(q--){
		cin >> c >> a >> n;
		ans = 0;
		team = 0;
		flagc=flaga=0;
		while(1){
			if(team == 3){
				ans++;
				team = 0;
			}
			if(c == 0)
				break;
			c--;
			team++;
			if(a>0 && team == 1){
				a--;
				flaga=1;
				team++;
			}
			if(n>0 && flaga ==1){
				n--;
				flaga = 0;
				team++;
			}
		}
		cout <<ans <<endl;
	}
}