import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;
import std.typecons;
import std.regex;
import std.range;

void main(){
    int q = readln().chomp().to!int;
    for(int i=0;i<q;i++){
	int c,a,n;
	int[] s = readln().split().to!(int[]);
	c = s[0];
	a = s[1];
	n = s[2];
	int res;
	if(n>0){
	    res = min(c,min(a,n));
	    int temp =  min(c,min(a,n));
	    c -= temp;
	    a -= temp;
	}
	if(a>0){
	    res += min(to!int(floor(to!real(c)/2.0)),a);
	    c -= 2*min(to!int(floor(to!real(c)/2.0)),a);
	}
	if(c>0)
	    res += to!int(floor(to!real(c)/3.0));
	writeln(res);
    }
}