#include <bits/stdc++.h>
using namespace std;
template <typename T>
T load() {
  T r;
  cin >> r;
  return r;
}
template <typename T>
vector<T> loadMany(int n) {
  vector<T> rs(n);
  generate(rs.begin(), rs.end(), &load<T>);
  return rs;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  auto q = load<int>();
  while (q-- > 0) {
    auto x = load<long long>();
    auto y = load<long long>();
    auto k = load<long long>();
    auto goods = 0ll;
    auto bads = 0ll;
    auto minpath = max(x, y);
    auto onemove = (x % 2) != (y % 2);
    if (minpath > k) {
      cout << "-1\n";
      continue;
    }
    if (onemove) {
      goods += minpath - 1;
      bads += 1;
    } else {
      goods += minpath;
    }
    auto k2 = k - minpath;
    if (k2 % 2 == 0) {
      goods += k2;
    } else {
      if (onemove) {
        goods += k2;
      } else {
        goods -= 1;
        bads += 2;
        goods += k2 - 1;
      }
    }
    cout << goods << '\n';
  }
}
