#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
signed main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    long long int n, m, k;
    cin >> n >> m >> k;
    if (max(abs(n), abs(m)) > k) {
      cout << -1 << '\n';
      continue;
    }
    int x = max(n, m), y = min(n, m);
    long long int tmp = (x - y) / 2;
    long long int ans = tmp * 2 + y;
    if ((x - y) % 2 == 0) {
      cout << ((k - ans) % 2 == 0 ? k : k - 2) << '\n';
      continue;
    }
    cout << k - 1 << '\n';
  }
  return 0;
}
