import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.array;

void main() {
	auto Q = readln.chomp.to!int;
	foreach (i; 0..Q) {
		auto input = readln.split.map!(to!int).array;
		//??????CAN?????°????±??????????CAN?????°??????min(C, A, N)????????????
		int can = min(input[0], input[1], input[2]);
		input[] -= can;
		//?¬????CCA?????°????±??????????CCA?????°??????
		int cca;
		if (input[0] > input[1] * 2) cca = input[1];
		else cca = input[0] / 2;
		input[0] -= cca * 2;
		int ccc = input[0] / 3;
		writeln(can + cca + ccc);
		
	}
}