#include<iostream>
#include<algorithm>
using namespace std;

int main() {
    int a, c ,n, q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> c >> a >> n;
        int tmp, sum = 0;
        tmp = min(c, min(a, n));
        c -= tmp; a -= tmp;
        sum = tmp;
        tmp = min(c / 2, a);
        c -= tmp * 2;
        sum += tmp;
        sum += c / 3;
        cout << sum << endl;
    }
    return 0;
}