#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long x, y, k;
    cin >> x >> y >> k;
    long long p = k - x;
    long long q = k - y;
    if (x > k || y > k)
      cout << "-1" << endl;
    else if (p == 0 && q == 0) {
      cout << x << endl;
    } else {
      if (p == 1 && q == 1)
        cout << min(x, y) - 1 << endl;
      else {
        int c = 0;
        if (p % 2 != 0) p--, c++;
        if (q % 2 != 0) q--, c++;
        if (c == 2)
          cout << min(x + p, y + q) - 1 << endl;
        else {
          cout << min(x + p, y + q) << endl;
        }
      }
    }
  }
}
