#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long x, y, k;
  scanf("%lld %lld %lld", &x, &y, &k);
  x = abs(x);
  y = abs(y);
  if (x > k || y > k) {
    printf("-1\n");
    return;
  }
  long long ret = k;
  if (x % 2 != k % 2) ret--;
  if (y % 2 != k % 2) ret--;
  printf("%lld\n", ret);
}
int main() {
  int qq;
  scanf("%d", &qq);
  while (qq--) solve();
}
