#include <bits/stdc++.h>
using namespace std;
double eps = 1e-6;
double pi = acos(0.0) * 2;
double dinf = 1e250;
long long INF = static_cast<long long>(2e18);
long long inf = static_cast<long long>(1e9 + 7);
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <class T>
void OUT(T a) {
  cout << a;
  exit(0);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long extgcd(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = extgcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x, y, k;
    cin >> x >> y >> k;
    if (x < 0) x = -x;
    if (y < 0) y = -y;
    if (x < y) swap(x, y);
    if (x > k)
      cout << -1 << endl;
    else {
      if ((x & 1) != (y & 1)) {
        k -= 1;
        x -= 1;
      } else if ((x & 1) != (k & 1)) {
        x -= 1;
        y -= 1;
        k -= 2;
      }
      cout << k << endl;
    }
  }
  return 0;
}
