#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+10;
#define int long long
#define Yes cout<<"YES"<<endl
#define No cout<<"NO"<<endl
#define f first
#define s second
const int M = 1e9+7;
#define all(x) (x).begin(),(x).end()
#define setprecision(x) fixed<<setprecision((int)(x))
bool odd(int num) {return ((num & 1) == 1);}
bool even(int num) {return ((num & 1) == 0);}
const int inf = 1e18;
void solve(){
int n,m,k;
cin>>n>>m>>k;
if((n+m+k)%2==0){
cout<<n+m+k<<endl;
return;
}
int odd = 0;
if(n&1) odd++;
if(m&1) odd++;
if(k&1) odd++;
if(odd==1){
cout<<n+m+k<<endl;
}else if(odd==2){
int ans = 0;
if(n%2==0){
ans += n;
ans += max(m,k);
if(max(m,k)==m) ans += k - 1;
else ans += m - 1;
}else if(m%2==0){
ans += m;
ans += max(n,k);
if(max(n,k)==n) ans += k - 1;
else ans += n - 1;
}else if(k%2==0){
ans += k;
ans += max(n,m);
if(max(n,m)==n) ans += m - 1;
else ans += n - 1;
}
cout<<ans<<endl;
}else if(odd==3){
int ans = 0;
ans = max({n,m,k});
if(ans==n){
ans += m + k - 2;
}else if(ans==m){
ans += n + k - 2;
}else if(ans==k){
ans += n + m - 2;
}
cout<<ans<<endl;
}
}
int32_t main(){
ios::sync_with_stdio(0);cin.tie(0);
//solve();
int t;
cin>>t;
for(int T=1;T<=t;T++){
//cout<<"Case "<<T<<": ";
solve();
}
return 0;
}