#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool sortinrev(const pair<long long int, long long int>& a,
               const pair<long long int, long long int>& b) {
  if (a.first == b.first) return b.second < a.second;
  return a.first < b.first;
}
void run(vector<int> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
void runl(vector<long long int> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}
int modInverse(long long int a, long long int m) {
  long long int m0 = m;
  long long int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
void numberOfNodes(int n, vector<int> adj[], vector<long long int>& count1,
                   int s, int e) {
  vector<int>::iterator u;
  count1[s] = 1;
  for (u = adj[s].begin(); u != adj[s].end(); u++) {
    if (*u == e) continue;
    numberOfNodes(n, adj, count1, *u, s);
    count1[s] += count1[*u];
  }
}
void solve() {
  long long int n, m, k;
  cin >> n >> m >> k;
  long long int mini = min(n, m), maxi = max(n, m);
  long long int need = maxi, ans = 0, left = maxi - mini;
  if (k < maxi) {
    cout << -1 << endl;
    return;
  }
  if (maxi != mini) {
    ans = mini;
    k -= mini;
    if (left % 2 == 0) {
      if ((k - left) % 2 == 0) {
        ans += (k);
      } else
        ans += (left - 1 + k - left - 1);
    } else {
      if ((k - left) % 2 == 0)
        ans += (left - 1 + (k - left));
      else
        ans += ((left) + (k - left - 1));
    }
  } else {
    ans = 0;
    left = maxi;
    if (left % 2 == 0) {
      if ((k - left) % 2 == 0) {
        ans += (k);
      } else
        ans += (k - 2);
    } else {
      if ((k - left) % 2 == 0) {
        ans += (k);
      } else
        ans += (k - 2);
    }
  }
  cout << ans << endl;
}
int main() {
  int tt;
  scanf("%d", &tt);
  while (tt--) {
    solve();
  }
  return 0;
}
