#include <bits/stdc++.h>
using namespace std;
int q;
long long x, y, k;
int main() {
  cin >> q;
  while (q--) {
    scanf("%lld%lld%lld", &x, &y, &k);
    long long mn = min(x, y);
    long long mx = max(x, y);
    if (mx > k) {
      cout << -1 << endl;
    } else {
      long long tmp1 = mx - mn;
      if (tmp1 == 0) {
        long long tmp = k - mn;
        if (tmp % 2 == 0) {
          cout << k << endl;
        } else {
          cout << k - 2 << endl;
        }
      } else if (tmp1 % 2 == 1) {
        cout << k - 1 << endl;
      } else if (tmp1 % 2 == 0) {
        if ((k - mn) % 2 == 0) {
          cout << k << endl;
        } else if ((k - mn) % 2 == 1) {
          cout << k - 2 << endl;
        }
      }
    }
  }
  return 0;
}
