#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); }
string s = "";
long long arr[1000005] = {0};
long long brr[1000005] = {0};
vector<long long> v;
vector<long long> g[1000005];
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n = 0, m = 0, k = 0, q = 0, ans = 0;
  long long x = 0, y = 0, t = 0, sum = 0, sz = 0;
  cin >> q;
  while (q--) {
    cin >> x >> y >> k;
    if (x < 0) x = -x;
    if (y < 0) y = -y;
    long long z = max(x, y);
    if (k < z || (k == 1 && z == 0)) {
      cout << -1 << endl;
      continue;
    }
    n = (x + y) - z;
    if ((k % 2 == 1 && z % 2 == 1 && n % 2 == 1) ||
        (k % 2 == 0 && z % 2 == 0 && n % 2 == 0)) {
      cout << k << endl;
      continue;
    }
    if ((k % 2 == 1 && z % 2 == 1 && n % 2 == 0) ||
        (k % 2 == 1 && z % 2 == 0 && n % 2 == 1) ||
        (k % 2 == 0 && z % 2 == 1 && n % 2 == 0) ||
        (k % 2 == 0 && z % 2 == 0 && n % 2 == 1)) {
      cout << k - 1 << endl;
      continue;
    }
    if ((k % 2 == 1 && z % 2 == 0 && n % 2 == 0) ||
        (k % 2 == 0 && z % 2 == 1 && n % 2 == 1)) {
      cout << k - 2 << endl;
    }
  }
  return 0;
}
