#include <bits/stdc++.h>
#define int long long
#define ull unsigned long long
#define pf push_front
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vi vector<int>
#define endl "\n"
using namespace std;
void solve(int tt) {
int n, m, k;
cin >> n >> m >> k;
int sum = n + m + k;
int odd = 0;
if (n & 1)
odd++;
if (m & 1)
odd++;
if (k & 1)
odd++;
odd--;
odd = max<int>(odd, 0);
sum -= odd;
cout << sum << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef ONPC
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int testcase = 1;
cin >> testcase;
for (int tt = 1; tt <= testcase; tt++) {
solve(tt);
}
return 0;
}