#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
using ll = long long;
void Solve()
{
vector<int> v(3);
for(int i=0; i<3; i++) cin >> v[i];
int cnt = 0, ans = 0;
for(int i=0; i<3; i++) (v[i]&1)? cnt : cnt += v[i];
// debug(cnt);
ans += cnt, cnt = 0;
for(int i=0; i<3; i++) (v[i]&1)? cnt = max(cnt, v[i]) : cnt;
for(int i=0; i<3; i++){
if(cnt && v[i]==cnt){
ans += cnt;
cnt = 0;
}else if(v[i]&1) ans += v[i]-1;
}
cout << ans << endl;
}
int32_t main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
ll t = 1;
cin >> t;
while (t--)
Solve();
return 0;
}