#include <bits/stdc++.h>
using namespace std;
int q;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> q;
  while (q--) {
    long long n, m, k;
    cin >> n >> m >> k;
    long long diag = max(n, m);
    long long rez = 0;
    if (diag > k) {
      cout << -1 << "\n";
      continue;
    }
    k -= min(n, m);
    rez += min(n, m);
    diag -= min(n, m);
    if (diag % 2 == 0) {
      if (k % 2 == 0)
        rez += k;
      else
        rez += k - 2;
    } else {
      if (k % 2 == 0)
        rez += k - 1;
      else
        rez += k - 1;
    }
    cout << rez << "\n";
  }
  return 0;
}
