#include<iostream>
using namespace std;

int main(){
	int Q,c,a,n;
	cin>>Q;

	while(Q--){
		cin>>c>>a>>n;
		int cnt=0;
		while(1<=n && 1<=c && 1<=a){
			c--;a--;n--;
			cnt++;
		}
		while(1<=a && 2<=c){
			c-=2;a--;
			cnt++;
		}
		while(3<=c){
			c-=3;
			cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}