#include long long int solve(long long int a, long long int b, long long int c) { long long int res = 0; if (a < c) res += 2 * a; else res += 2 * c; a -= res / 2; c -= res / 2; res += b / 2 * 2; b %= 2; if (a > 0 && b > 0) res++; res += c / 2; return res; } int main() { int t; scanf("%d", &t); long long int a, b, c; for (; t > 0; t--) { scanf("%lld %lld %lld", &a, &b, &c); printf("%lld\n", solve(a, b, c)); } return 0; }