#include <iostream>

using namespace std;

int main() {
    int m, c, a, n;
    cin >> m;
    while (m--) {
        int ans = 0;
        cin >> c >> a >> n;
        while (c > 0 && a > 0 && n > 0) {
            c--;
            a--;
            n--;
            ans++;
        }
        while (c > 1 && a > 0) {
            c -= 2;
            a--;
            ans++;
        }
        while (c > 2) {
            c -= 3;
            ans++;
        }
        cout << ans << endl;
    }

    return 0;
}