#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    long long x, y, k, res;
    cin >> x >> y >> k;
    x = abs(x);
    y = abs(y);
    long long base = min(x, y);
    long long delta = max(x, y) - base;
    if (base + delta > k) {
      res = -1;
    } else {
      long long rest = k - base;
      if (delta % 2 != 0) {
        res = k - 1;
      } else {
        if (rest % 2 == 0) {
          res = k;
        } else {
          res = k - 2;
        }
      }
    }
    cout << res << endl;
  }
}
