#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  long long n, m, k;
  cin >> q;
  while (q--) {
    cin >> n >> m >> k;
    if (n > k || m > k) {
      cout << -1 << endl;
      continue;
    }
    cout << k - ((k - m) % 2) - ((k - n) % 2) << "\n";
  }
  return 0;
}
