#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int q;
  long long int x, y, k;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%lld %lld %lld", &x, &y, &k);
    if (x < 0) {
      x *= -1;
    }
    if (y < 0) {
      y *= -1;
    }
    if (x > k || y > k) {
      printf("-1\n");
      continue;
    }
    long long int cx, cy;
    if ((x - k) % 2 == 0) {
      cx = k;
    } else {
      cx = k - 1;
    }
    if ((y - k) % 2 == 0) {
      cy = k;
    } else {
      cy = k - 1;
    }
    if (max(cx, cy) == k) {
      printf("%lld\n", min(cx, cy));
    } else {
      printf("%lld\n", k - 2);
    }
  }
  return 0;
}
