#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  unsigned long long n, m, k;
  scanf("%d", &q);
  while (q--) {
    scanf("%llu%llu%llu", &n, &m, &k);
    unsigned long long dn = max(n, m);
    if (dn > k) {
      printf("-1\n");
      continue;
    }
    if ((n + m) % 2 == 0) {
      if ((k - dn) % 2 == 0)
        printf("%llu\n", k);
      else
        printf("%llu\n", k - 2);
    } else {
      printf("%llu\n", k - 1);
    }
  }
  return 0;
}
