#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = ((res % p) * (x % p)) % p;
    y = y >> 1;
    x = ((x % p) * (x % p)) % p;
  }
  return res;
}
long long raichu(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = ((res) * (x));
    y = y >> 1;
    x = ((x) * (x));
  }
  return res;
}
bool isprime(long long n) {
  if (n < 2)
    return false;
  else if (n == 2)
    return true;
  else if (n % 2 == 0)
    return false;
  else {
    long long z = sqrt(n);
    for (long long i = 0; i < z - 1; i++)
      if (n % (i + 2) == 0) return false;
    return true;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1, T;
  T = t;
  while (t--) {
    long long q;
    cin >> q;
    while (q--) {
      long long n, m, k;
      cin >> n >> m >> k;
      if (min(n, m) + max(n, m) - min(n, m) > k)
        cout << -1 << endl;
      else if (n == m) {
        long long left = k - n + 1;
        if (left % 2 == 0)
          cout << n - 1 + (left - 2) << endl;
        else
          cout << n - 1 + left << endl;
      } else {
        long long left = (k - max(n, m) + min(n, m));
        long long consumed = k - left;
        long long ans = consumed - (consumed % 2);
        long long tt = left - min(n, m) + 1;
        if (consumed % 2 == 0) {
          if (tt % 2 == 0)
            ans += (min(n, m) - 1 + tt - 2);
          else
            ans += (min(n, m) - 1 + tt);
        } else {
          ans += (min(n, m) - 1 + tt);
        }
        cout << ans << endl;
      }
    }
  }
  return 0;
}
