#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    long long x, y, k;
    cin >> x >> y >> k;
    long long cnt = min(x, y) * 2;
    long long mn = min(x, y), mx = max(x, y);
    long long total = mn + (mx - mn);
    if (total > k)
      cout << "-1\n";
    else if ((x + y) % 2 == 0) {
      if (x % 2 == 0) {
        if (k % 2 == 0)
          cout << k << "\n";
        else
          cout << k - 2 << "\n";
      } else {
        if (k % 2 == 1)
          cout << k << "\n";
        else
          cout << k - 2 << "\n";
      }
    } else {
      cout << k - 1 << "\n";
    }
  }
  return 0;
}
