#include <bits/stdc++.h>
using namespace std;
long long tot;
long long gerak;
bool isPossible(long long x, long long y, long long k) {
  gerak = min(x, y);
  x -= gerak;
  y -= gerak;
  tot = gerak + x + y;
  return tot <= k;
}
int main() {
  int q, i, j;
  long long n, m, k;
  scanf("%d", &q);
  while (q--) {
    scanf("%lld %lld %lld", &n, &m, &k);
    tot = 0;
    gerak = 0;
    long long ans = 0;
    if (!isPossible(n, m, k)) {
      printf("-1\n");
      continue;
    } else {
      ans += gerak;
      n -= gerak;
      m -= gerak;
      k -= gerak;
      long long total = n + m;
      if (total % 2 == 1) {
        ans += (total - 1);
        k -= (total - 1);
        k--;
        ans += k;
      } else {
        ans += total;
        k -= total;
        if (k % 2 == 1) {
          k -= 2;
        }
        ans += k;
      }
      printf("%lld\n", ans);
    }
  }
  return 0;
};
