#include <bits/stdc++.h>
using namespace std;
const double EPS = (double)1e-9;
const double PI = (double)acos(-1.0);
int irand(int lo, int hi) {
  return (((double)rand()) / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo;
}
string toString(long long x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
long long toNumber(string S) {
  long long ret;
  sscanf(S.c_str(), "%lld", &ret);
  return ret;
}
const int INF = (int)2e9;
const long long MOD = (long long)1e9 + 7;
long long solve() {
  long long n, m, k;
  scanf("%lld %lld %lld", &n, &m, &k);
  if (n > m) swap(n, m);
  if (k < m) return (long long)-1;
  long long isOddStep = ((m - n) & 1);
  long long remainder = (k - m);
  if (isOddStep == 0 && (remainder & 1)) remainder -= (long long)2;
  return m - isOddStep + remainder;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) printf("%lld\n", solve());
  return 0;
}
