#include <bits/stdc++.h>
#pragma GCC optimize("03")
using namespace std;
long long k, a[500100], m, rs, n, q;
string s, c;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> q;
  for (int i = 1; i <= q; i++) {
    cin >> n >> m >> k;
    if (max(n, m) > k) {
      cout << "-1\n";
      continue;
    }
    long long diff = abs(n - m);
    long long mxd = max(n, m) - 1;
    long long moves = k - mxd;
    if (diff % 2 == 0) {
      mxd += moves & 1 ? moves : moves - 2;
    } else {
      mxd += moves - 1;
    }
    cout << mxd << "\n";
  }
  return 0;
}
