#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

int q;
int p[3];

int main() {
    std::cin >> q;

    while(q--) {
        std::cin >> p[0] >> p[1] >> p[2];

        int sum = std::min(p[2], std::min(p[0], p[1])); //t3
        
        p[0] -= sum;
        p[1] -= sum;
        p[2] -= sum;
        
        int t2 = std::min(p[0] / 2, p[1]);

        sum += t2;

        p[0] -= t2 * 2;
        p[1] -= t2;

        sum += p[0] / 3;

        std::cout << sum << std::endl;
    }
}