#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long n, m, k;
    cin >> n >> m >> k;
    long long stepmin = max(m, n);
    if (k < stepmin)
      cout << "-1" << endl;
    else {
      long long temp = max(m, n) - min(m, n);
      if (temp % 2 == 0) {
        if (((k - temp + min(m, n)) % 2 == 0))
          cout << k << endl;
        else
          cout << k - 2 << endl;
      } else {
        cout << k - 1 << endl;
      }
    }
  }
}
