#include <bits/stdc++.h>
using namespace std;
string itos(long long x) {
  string s;
  while (x || !s.length()) {
    s = (char)(x % 10 + 48) + s;
    x /= 10;
  }
  return s;
}
long long fact(long long x) {
  if (x == 0)
    return 1;
  else
    return x * fact(x - 1);
}
struct T {
  int x;
  int y;
  int z;
};
bool co(int a, int b) { return a > b; }
int inf = 1000000009;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k, p;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x, y, k;
    cin >> x >> y >> k;
    long long kol = x + y;
    if (kol - min(x, y) > k) {
      cout << -1 << '\n';
      continue;
    }
    kol = k;
    if ((x + y) % 2 == 0) {
      if (x % 2 != k % 2) kol -= 2;
    } else {
      kol--;
    }
    cout << kol << endl;
  }
}
