#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int use[105][105];
long long int dp[105], sum = 0;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long int x, y, k;
    cin >> x >> y >> k;
    if (max(x, y) > k) {
      cout << -1 << endl;
      continue;
    }
    long long int a = max(x, y), b = min(x, y);
    if ((a - b) % 2 == 1) {
      cout << k - 1 << endl;
    } else {
      if ((k - a) % 2 == 1) {
        cout << k - 2 << endl;
      } else {
        cout << k << endl;
      }
    }
  }
  return 0;
}
