#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long x, y, k;
    cin >> x >> y >> k;
    x = abs(x);
    y = abs(y);
    long long m = max(x, y);
    if (k < m) {
      cout << -1 << endl;
      continue;
    }
    long long z = abs(x - y);
    if (z % 2 == 0) {
      long long a = k - m;
      if (a % 2 == 0)
        cout << k << endl;
      else
        cout << k - 2 << endl;
    } else {
      cout << k - 1 << endl;
    }
  }
}
