#include <bits/stdc++.h>
using namespace std;
long long int notmain(long long int c, long long int d) {
  int r;
  long long int t;
  r = (c + d) % 2;
  if (r == 0) {
    t = d;
  } else {
    t = d - 1;
  }
  return t;
}
int main() {
  int a;
  cin >> a;
  for (int x = 0; x < a; x = x + 1) {
    long long int o, m, n, k, stepx, stepy;
    cin >> m >> n >> k;
    if (m > k || n > k) {
      cout << -1 << endl;
    } else {
      stepx = notmain(m, k);
      stepy = notmain(n, k);
      if (stepx < k && stepy < k) {
        o = min(stepx, stepy) - 1;
      } else {
        o = min(stepx, stepy);
      }
      cout << o << endl;
    }
  }
}
