#include <bits/stdc++.h>
using namespace std;
#define optimize() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); /*cout.tie(NULL);*/
#define fraction() \
cout.unsetf(ios::floatfield); \
cout.precision(20); \
cout.setf(ios::fixed, ios::floatfield);
#define file() \
freopen("input.txt", "r", stdin); \
freopen("output", "w", stdout);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int lcm(int a, int b) { return (a * b) / __gcd(a, b); }
int gcd(int a, int b) { return __gcd(a, b); }
typedef pair<int, int> pr;
typedef long long ll;
#define el "\n"
const int mod = 1e9 + 7;
const int mx = 1e5 + 125;
bool com(const pair<int, int> &p1, const pair<int, int> &p2)
{
// if (p1.first == p2.first)
// {
// return p1.second > p2.second;
// }
return p1.first < p2.first;
}
void giveanswer()
{
int n,m,k;
cin>>n>>m>>k;
bool f=0;
if(n==1)n=1;
else
{
if(n%2){n-=1;f=1;}
}
if(m==1)m=1;
else
{
if(m%2){m-=1;f=1;}
}
if(k==1)m=k=1;
else
{
if(k%2){k-=1;f=1;}
}
if(f==1 and m!=1 and n!=1 and k!=1)cout<<n+m+k+1<<el;
else cout<<n+m+k<<el;
}
int main()
{
optimize();
fraction();
int t;
cin >> t;
while (t--)
{
giveanswer();
}
}