#include using namespace std; #ifdef _RUTHEN #include #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; void solve() { V D(3); rep(i, 3) cin >> D[i]; show(D); V> P = {{0, 0}, {0, 1}, {0, 2}, {1, 1}, {1, 2}, {2, 2}}; ll ans = 0; do { // show(P); auto DC = D; ll cur = 0; for (auto [a, b] : P) { if (a != b) { ll mn = min(D[a], D[b]); ll s = (a + b) % 3; cur += mn * s; D[a] -= mn; D[b] -= mn; } else { ll c = D[a] / 2; ll s = (a + b) % 3; cur += c * s; D[a] -= c * 2; } } ans = max(ans, cur); show(D); D = DC; } while (next_permutation(P.begin(), P.end())); cout << ans << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) solve(); return 0; }