q = int(input())
for i in range(q):
n,m,k = list(map(int, input().split()))
if max(n,m) > k:
print(-1)
else:
print(k-int(1 if (n+m) % 2 else (n%2+k%2) % 2 * 2))
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f, MOD = 1e9+7;
const int INF_INT = 0x3f3f3f3f;
const long double PI = acosl(-1.), EPS = 1e-9;
using namespace std;
//cout << fixed << setprecision(6)
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen("in", "r", stdin); //test input
int t;
cin >> t;
while(t--){
ll n, m, k;
cin >> n >> m >> k;
ll minmov = max(n,m);
if(k >= minmov ){
//so its possible.
if(n%2 != m%2){
cout << k-1 << "\n";
}else{
if(k%2 == m%2) cout << k << "\n";
else cout << k-2 << "\n";
}
}else cout << "-1\n";
}
}
1613B - Absent Remainder | 1536B - Prinzessin der Verurteilung |
1699B - Almost Ternary Matrix | 1545A - AquaMoon and Strange Sort |
538B - Quasi Binary | 424A - Squats |
1703A - YES or YES | 494A - Treasure |
48B - Land Lot | 835A - Key races |
1622C - Set or Decrease | 1682A - Palindromic Indices |
903C - Boxes Packing | 887A - Div 64 |
755B - PolandBall and Game | 808B - Average Sleep Time |
1515E - Phoenix and Computers | 1552B - Running for Gold |
994A - Fingerprints | 1221C - Perfect Team |
1709C - Recover an RBS | 378A - Playing with Dice |
248B - Chilly Willy | 1709B - Also Try Minecraft |
1418A - Buying Torches | 131C - The World is a Theatre |
1696A - NIT orz | 1178D - Prime Graph |
1711D - Rain | 534A - Exam |