#include <bits/stdc++.h>
using namespace std;
void print(vector<int> v) {
  vector<int>::iterator it = v.begin();
  while (it != v.end()) {
    cout << *it << " ";
    it++;
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long x, y, k;
    cin >> x >> y >> k;
    if ((x + y) % 2 == 1) {
      long long mn = max(x, y);
      if (k < mn) {
        cout << -1 << endl;
      } else {
        cout << k - 1 << endl;
      }
    } else {
      long long mn = max(x, y);
      if (k < mn) {
        cout << -1 << endl;
      } else {
        if ((k - mn) % 2 == 0) {
          cout << k << endl;
        } else {
          cout << k - 2 << endl;
        }
      }
    }
  }
}
