#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2>& p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (auto& i : v) {
    out << i << "\n";
  }
  return out;
}
const int MAX = 500007;
pair<long long, long long> DP[MAX][2];
long long numbers[MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tests;
  cin >> tests;
  for (int t = (0); t < (tests); ++t) {
    long long x, y, k;
    cin >> x >> y >> k;
    if (x < y) {
      swap(x, y);
    }
    if (x > k) {
      cout << -1 << "\n";
      continue;
    }
    if ((x & 1ll) != (y & 1ll)) {
      if ((x & 1ll) != (k & 1ll)) {
        cout << k - 1ll << "\n";
        continue;
      }
      cout << k - 1ll << "\n";
      continue;
    } else {
      if ((x & 1ll) != (k & 1ll)) {
        cout << k - 2ll << "\n";
        continue;
      }
      cout << k << "\n";
      continue;
    }
  }
  return 0;
}
