#include <bits/stdc++.h>
using namespace std;
mt19937 randGenerator(25897453);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, q;
  long long n, m, k, p;
  cin >> q;
  for (i = 1; i <= q; i++) {
    cin >> n >> m >> k;
    p = max(n, m);
    if (p > k) {
      cout << -1 << endl;
      continue;
    }
    if (abs(n - m) % 2 == 0 && min(n, m) % 2 == 1) {
      if (k % 2 == 1)
        cout << k << endl;
      else
        cout << k - 2 << endl;
      continue;
    }
    if (abs(n - m) % 2 == 1) {
      cout << k - 1 << endl;
      continue;
    }
    if (k % 2 == 0)
      cout << k << endl;
    else
      cout << k - 2 << endl;
  }
}
