#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    long long int a, b, k;
    cin >> a >> b >> k;
    long long int ans = 0;
    long long int sum = a + b;
    long long int moves_left = k;
    if (sum % 2 == 0) {
      long long int min_steps = max(a, b);
      if (k < min_steps)
        ans = -1;
      else {
        ans = ans + min_steps;
        moves_left = moves_left - min_steps;
        if (moves_left % 2 == 0) {
          ans = ans + moves_left;
        } else {
          if (moves_left == 1) {
            ans = ans - 1;
          } else {
            ans = ans + moves_left - 2;
          }
        }
      }
    } else {
      long long int min_steps = max(a, b) - 1;
      moves_left = moves_left - min_steps;
      if (k < min_steps + 1)
        ans = -1;
      else {
        if (moves_left % 2 == 0)
          ans = k - 1;
        else {
          ans = k - 1;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
