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