#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926536;
const long long prime = 1e9 + 7;
const long long maxN = 3e5 + 3;
const long long maxans = 1e10 + 3;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q, n, m, k;
  cin >> q;
  while (q--) {
    cin >> n >> m >> k;
    if (max(n, m) > k) {
      cout << -1 << endl;
      continue;
    }
    if ((n % 2 == 0) && (m % 2 == 0)) {
      if (k % 2 == 0) {
        cout << k << endl;
      } else {
        cout << k - 2 << endl;
      }
    } else if ((n % 2 != 0) && (m % 2 != 0)) {
      if (k % 2 == 0) {
        cout << k - 2 << endl;
      } else {
        cout << k << endl;
      }
    } else {
      cout << k - 1 << endl;
    }
  }
  return 0;
}
