#include<bits/stdc++.h>
using namespace std;

int main(){
	int Q, c, a, n, s[110] = {}, t;
	
	cin>>Q;

	for(int i = 0; i < Q; i++){
		cin>>c>>a>>n;

		t = min(c, a);
		t = min(t, n);
		c -= t; a-= t; n-= t;
		s[i] += t;

		t = min(c / 2 , a);
		c -= t * 2; a -= t;
		s[i] += t;
		
		s[i] += c/3;
		
	}
	for(int i = 0; i < Q; i++){
		cout<<s[i]<<endl;
	}
	return 0;
}

