#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  int i;
  long long n[q], m[q], k[q];
  for (i = 0; i < q; i++) {
    cin >> n[i] >> m[i] >> k[i];
  }
  for (i = 0; i < q; i++) {
    if (k[i] < n[i] || k[i] < m[i]) {
      cout << -1 << '\n';
    } else {
      if (m[i] % 2 == 0 && n[i] % 2 == 0 && k[i] % 2 == 0) {
        cout << k[i] << '\n';
      } else if (m[i] % 2 == 0 && n[i] % 2 == 0 && k[i] % 2 != 0) {
        cout << k[i] - 2 << '\n';
      } else if (m[i] % 2 != 0 && n[i] % 2 != 0 && k[i] % 2 == 0) {
        cout << k[i] - 2 << '\n';
      } else if (m[i] % 2 != 0 && n[i] % 2 != 0 && k[i] % 2 != 0) {
        cout << k[i] << '\n';
      } else {
        cout << k[i] - 1 << '\n';
      }
    }
  }
  return 0;
}
