#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int Q;
	int can[3];
	int total,temp;

	scanf("%d",&Q);
	for(int i = 0; i < Q; i++){
		total = 100000;
		for(int j = 0; j < 3; j++){
			scanf("%d",&can[j]);
			if(total > can[j])
				total = can[j];
		}

		for(int j = 0; j< 3; j++)
			can[j] -= total;

		temp = min(can[0]/2,can[1]);
		total += temp;
		can[0] -= temp*2;
		can[1] -= temp;

		total += can[0]/3;

		printf("%d\n",total);
	}

	return 0;
}