#include<bits/stdc++.h>
#define ll long long
#define py cout<<"YES"<<endl
#define pn cout<<"NO"<<endl
#define pe cout<<endl
#define av vector<int>a(n)
#define ai for(auto &i:a)cin>>i
#define ao for(auto i:a)cout<<i<<" "
#define mod 1000000007
using namespace std;
bool prime(int n)
{
if(n<2) return false;
if(n<=3) return true;
if(n%2==0) return false;
for(int i=3; i*i<=n; i+=2)
if(n%i==0) return false;
return true;
}
ll bigmod(ll b,ll p)
{
if(p==0) return 1;
ll x=bigmod(b,p/2);
x=(x*x)%mod;
if(p%2==1) x=(x*b)%mod;
return x;
}
vector<int>adj[200005];
int vis[200005];
void DFS(int node)
{
vis[node]=1;
for(ll i=0; i<adj[node].size(); i++)
{
if(vis[adj[node][i]]==0)
DFS(adj[node][i]);
}
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll t; cin>>t;
while(t--)
{
ll n,m,k; cin>>n>>m>>k;
ll sum=n+m+k,odd=0;
if(n%2==1) odd++;
if(m%2==1) odd++;
if(k%2==1) odd++;
if( odd==3 ) cout<<sum-2;
else if(odd==2) cout<<sum-1;
else cout<<sum;
pe;
}
}