#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 5;
int main() {
  int t;
  scanf("%d", &t);
  long long int n, m, k;
  while (t--) {
    cin >> n >> m >> k;
    if (max(n, m) > k) {
      cout << -1 << endl;
    } else if ((n + m) % 2)
      cout << k - 1 << endl;
    else if (max(n, m) % 2 == k % 2)
      cout << k << endl;
    else
      cout << k - 2 << endl;
  }
  return 0;
}
