#include <bits/stdc++.h>
using namespace std;
long long read() {
  char c = getchar();
  long long x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int main() {
  long long q = read();
  for (long long i = 1; i <= q; i++) {
    long long n = read(), m = read(), k = read();
    if (n > k || m > k) {
      printf("-1\n");
    } else if (n % 2 == m % 2) {
      if (k % 2 == n % 2)
        printf("%I64d\n", k);
      else
        printf("%I64d\n", k - 2);
    } else {
      printf("%I64d\n", k - 1);
    }
  }
  return 0;
}
