#include <bits/stdc++.h>
#pragma optimize("", off)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:36777216")
const long long mod = 1000000007;
using namespace std;
template <class T>
void smin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void smax(T& a, T val) {
  if (a < val) a = val;
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (auto i : v) {
    if (!first) os << ", ";
    os << i;
    first = false;
  }
  return os << "]";
}
const long long N = 2 * 1e5 + 10;
long long q, n, m, k;
string s;
void no() { cout << "-1" << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> q;
  for (long long i = 0; i < q; ++i) {
    cin >> n >> m >> k;
    long long mi = min(n, m);
    long long ma = max(n, m);
    if (k < ma) {
      no();
      continue;
    }
    long long ans = 0LL;
    if ((m + n) % 2 == 0) {
      ans = ma;
      if ((k - ma) % 2 == 0) {
        ans += k - ma;
      } else {
        ans += k - ma - 2;
      }
    } else {
      ans = ma - 1;
      ans += k - ans - 1;
    }
    cout << ans << '\n';
  }
  return 0;
}
