#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  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;
    } else {
      int x = (max(n, m) - min(n, m)) % 2;
      int y = (k - min(n, m)) % 2;
      if (x == 0 && y == 0) {
        cout << k << endl;
      } else if (x == 0 && y == 1) {
        cout << (k - 2) << endl;
      } else if (x == 1 && y == 0) {
        cout << k - 1 << endl;
      } else {
        cout << k - 1 << endl;
      }
    }
  }
}
