#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
int q;
long long n, m, k;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) {
    cin >> n >> m >> k;
    long long a = labs(n - m);
    long long maxi = max(n, m);
    long long ans = k;
    if (k >= maxi) {
      if ((k - maxi) % 2 == 1) {
        ans -= 2;
        if (a % 2 == 1) {
          ans++;
        }
      } else {
        if (a % 2 == 1) {
          ans--;
        }
      }
      cout << ans << '\n';
    } else {
      cout << -1 << '\n';
    }
  }
  return 0;
}
