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