#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q;
  while (cin >> q) {
    for (int i = 1; i <= q; i++) {
      long long n, m, k;
      cin >> n >> m >> k;
      if (max(n, m) > k) {
        cout << -1 << endl;
        continue;
      }
      int x = (n + k) % 2;
      int y = (m + k) % 2;
      if (x ^ y != 0)
        cout << k - 1 << endl;
      else if (x != 0)
        cout << k - 2 << endl;
      else
        cout << k << endl;
    }
  }
  return 0;
}
