#include <bits/stdc++.h>
using namespace std;
long long n, m, k, l, h, a, b, c, d, e, f, ans = 0;
int main() {
  cin >> n;
  for (int t = 1; t <= n; t++) {
    cin >> a >> b >> k;
    ans = k;
    if (a < b) swap(a, b);
    if (a > k) {
      cout << "-1" << endl;
      continue;
    } else {
      if ((k - a) % 2) ans--;
      if ((k - b) % 2) ans--;
      cout << ans << endl;
    }
  }
  return 0;
}
