#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    long long int n, m, k;
    cin >> n >> m >> k;
    if (k < max(n, m)) {
      cout << "-1" << '\n';
      continue;
    }
    long long int rem = k - max(n, m);
    if (abs(n - m) % 2 == 0 && rem % 2 == 0) cout << k << '\n';
    if (abs(n - m) % 2 == 0 && rem % 2 == 1) cout << k - 2 << '\n';
    if (abs(n - m) % 2 == 1 && rem % 2 == 0) cout << k - 1 << '\n';
    if (abs(n - m) % 2 == 1 && rem % 2 == 1) cout << k - 1 << '\n';
  }
  return 0;
}
