#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t>0){ t--; long long a,b,c; cin >> a >> b >> c; long long res=0; long long del; res+=(b/2)*2; b%=2; del=min(a,c); res+=2*del; a-=del;c-=del; del=min(a,b); res+=del; a-=del;b-=del; res+=(c/2); cout << res << "\n"; } return 0; }