#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;


int main() 
{  
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) 
	{
		int c, d, e;
		cin >> c >> d >> e;
		int s = 0;
		for (int f = 0; f <=c / 3; f++) {
			for (int g = 0; g <= (c - f * 3) / 2 && g <= d;g++) {
				vector<int>h{ (c - f * 3 - g * 2),d - g,e };
				sort(h.begin(), h.end());
				if (s < h[0]+f+g)s = h[0]+f+g;
			}
		}
		cout << s << endl;
	}
}