#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q, i, j, m, x, y, res, mn, k;
  scanf("%lld", &q);
  for (i = 1; i <= q; i++) {
    scanf("%lld %lld %lld", &x, &y, &k);
    mn = min(x, y) + abs(x - y);
    if (mn > k) {
      printf("-1\n");
    } else {
      res = k - (k - x) % 2 - (k - y) % 2;
      printf("%lld\n", res);
    }
  }
}
