#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n;
vector<char>c(100);
int main() {
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int C, A, N, ans = 0;
		cin >> C >> A >> N;
		for (int i = 0; i <= 1000; i++) {
			for (int j = 0; j <= 1000; j++) {
				int c = C;
				int a = A;
				int n = N;
				c -= i; a -= i; n -= i;
				c -= j * 2; a -= j;
				if (c >= 0 && a >= 0 && n >= 0) {
					ans = max(ans,i + j + c / 3);
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}