#include #include #ifdef SHO_LOCAL #include "debug.h" #else #define debug(...) \ {} #endif using namespace std; void solution() { long long A, B, C; cin >> A >> B >> C; long long a = A, b = B, c = C; long long ans = 0; auto Reset = [&]() { ans = 0; a = A, b = B, c = C; }; auto cc = [&]() { ans += c / 2; c = c % 2; }; auto ac = [&]() { long long t = min(a, c); ans += t * 2; a = max(0LL, a - t); c = max(0LL, c - t); }; auto ab = [&]() { long long t = min(a, b); ans += t; a = max(0LL, a - t); b = max(0LL, b - t); }; auto bb = [&]() { ans += b / 2 * 2; b = b % 2; }; long long res = 0; vector p(4); iota(p.begin(), p.end(), 0); do { Reset(); for (int i = 0; i < 4; i++) { int j = p[i]; if (j == 0) ab(); else if (j == 1) ac(); else if (j == 2) bb(); else cc(); } res = max(res, ans); } while (next_permutation(p.begin(), p.end())); cout << res << '\n'; } int main() { iostream::sync_with_stdio(0), cin.tie(0), cout.tie(0); int TT; cin >> TT; for (int tc = 1; tc <= TT; tc++) { // cout << "Case #" << tc << ": " << solution() << '\n'; solution(); } return 0; }