#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q;
  cin >> q;
  for (int kai = 0; kai < q; kai++) {
    long long x, y, k;
    cin >> x >> y >> k;
    x = abs(x);
    y = abs(y);
    if (x > y) swap(x, y);
    if (y > k) {
      cout << -1 << endl;
      continue;
    }
    long long lk = k - y;
    long long ly = y - x;
    if (lk == 1) {
      if (ly % 2 == 1) {
        cout << k - 1 << endl;
      } else {
        cout << k - 2 << endl;
      }
    } else if (lk % 2 == 0) {
      if (ly % 2 == 1) {
        cout << k - 1 << endl;
      } else {
        cout << k << endl;
      }
    } else {
      if (ly % 2 == 1) {
        cout << k - 1 << endl;
      } else {
        cout << k - 2 << endl;
      }
    }
  }
  return 0;
}
