#include <iostream>
using namespace std;

int main(){

	int q;
	cin >> q;
	for (int i = 0; i < q; i++){

		int c, a, n;
		int count = 0;

		cin >> c >> a >> n;

		for (; c > 0 && a > 0 && n > 0; count++){
			c--; a--; n--;
		}
		for (; c >= 2 && a > 0; count++){
			c -= 2; a--;
		}
		for (; c >= 3; count++)
			c -= 3;

		cout << count << endl;
	}
}