// 2013/08/30 Tazoe

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

int main()
{
	int Q;
	cin >> Q;

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

		int t = 0;

		int can = min(min(c, a), n);
		t += can;
		c -= can;
		a -= can;

		int cca = min(c/2, a);
		t += cca;
		c -= cca*2;

		int ccc = c/3;
		t += ccc;

		cout << t << endl;
	}

	return 0;
}