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