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