#include"bits/stdc++.h"
using namespace std;
int maxx = 0;
int main() {
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int c, a, n;
		cin >> c >> a >> n;
		while (c >= 1 && a >= 1 && n >= 1) {
			c--;
			a--;
			n--;
			maxx++;
		}
		while (c >= 2 && a >= 1) {
			c -= 2;
			a--;
			maxx++;
		}
		while(c >= 3) {
			c -= 3;
			maxx++;
		}
		cout << maxx << endl;
		maxx = 0;
	}
}