#include <bits/stdc++.h>
using namespace std;
template <typename T>
void write(ostream& out, T t) {
  out << t << "\n";
}
template <typename T, typename... Args>
void write(ostream& out, T t, Args... args) {
  out << t << ' ';
  write(out, args...);
}
template <typename... Args>
void debug(Args... args) {}
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 212345;
long long n, m, k;
int s[MAXN];
void prep_cin() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
long long solve(long long i, long long j, long long k) {
  long long mnd = max(i, j);
  if (mnd > k) {
    return -1;
  }
  long long ans = k;
  if ((k - mnd) & 1ll) ans -= 2ll;
  return ans;
}
int main() {
  int t;
  scanf("%d", &t);
  for (int tt = 1; tt <= t; tt++) {
    scanf("%lld%lld%lld", &n, &m, &k);
    long long ans = -1;
    if (((n + m) & 1)) {
      ans = max(ans, solve(n + 1, m, k - 1));
      ans = max(ans, solve(n - 1, m, k - 1));
      ans = max(ans, solve(n, m + 1, k - 1));
      ans = max(ans, solve(n, m - 1, k - 1));
    } else
      ans = solve(n, m, k);
    printf("%lld\n", ans);
  }
}
