#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  long long x, y, k;
  cin >> q;
  while (q--) {
    cin >> x >> y >> k;
    if (k < max(x, y))
      cout << -1 << endl;
    else
      cout << k - ((k - x) & 1) - ((k - y) & 1) << endl;
  }
  return 0;
}
