#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
const int inf = INT_MAX / 2;
const long long infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long N, M, K;
long long solve() {
  cin >> N >> M >> K;
  if (N > M) swap(N, M);
  if (N == M) {
    if (K < N) return -1;
    long long ans = N - 1;
    K -= N - 1;
    if (K % 2 == 0)
      ans += K - 2;
    else
      ans += K;
    return ans;
  }
  long long ans = N;
  long long req = N;
  M -= N;
  if (M % 2 == 0) {
    ans += M - 2;
    req += M - 2;
    M = 2;
    if (K < req + 2) return -1;
    ans++;
    req++;
    long long d = K - req;
    if (d % 2 == 1)
      ans += d;
    else
      ans += d - 2;
    return ans;
  } else {
    ans += M - 1;
    req += M - 1;
    M = 1;
    if (K < req + 1) return -1;
    long long d = K - req;
    ans += d - 1;
    return ans;
  }
}
void _main() {
  int T;
  cin >> T;
  for (int t = 0; t < T; t++) {
    auto ans = solve();
    printf("%lld\n", ans);
  }
}
