#include<iostream>
#include<algorithm>
using namespace std;

int main() {
	int q;
	cin >> q;
	while(q--){
		int c, a, n;
		cin >> c >> a >> n;
		int tmp, sum = 0;
		tmp = min( c, min( a, n ) );
		c-=tmp;	a-=tmp;
		sum = tmp;
		tmp = min( c/2, a );
		c-=tmp*2;
		sum += tmp;
		sum += c/3;
		cout << sum << endl;
	}
	return 0;
}