#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
	int q; scanf("%d",&q);
	for(int i=0;i<q;i++){
		int c,a,n;
		scanf("%d%d%d",&c,&a,&n);
		int res=min(n,min(c,a));
		c-=res,a-=res,n-=res;
		int x=min(a,c/2);
		res+=x;
		a-=x,c-=x*2;
		res+=c/3;
		printf("%d\n",res);
	}
}