#include <bits/stdc++.h>
using namespace std;
int _I() {
  int x;
  scanf("%d", &x);
  return x;
}
long long _L() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long gcd(long long a, long long b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
long long lcm(long long x, long long y) {
  x /= gcd(x, y);
  return x * y;
}
int kdx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int kdy[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
long long _pow(long long a, long long b) {
  if (b == 0) return 1;
  long long ret = 1;
  ret *= _pow(a, b / 2);
  ret = ret * ret;
  if (b & 1) {
    ret *= a;
  }
  return ret;
}
bool inrng(long long x, long long y, long long c) { return (x <= c && c <= y); }
bool inRng(int a, int b, int x, int y) {
  return (inrng(a, b, x) || inrng(a, b, y) || inrng(x, y, a) || inrng(x, y, b));
}
struct data {
  int x = 0, y = 0;
};
int cases;
map<char, int> mp;
void lipu_mira() {
  long long i, j, a, b, n, k, v, x, ans = 0, now;
  a = _L();
  b = _L();
  k = _L();
  if (a > b) swap(a, b);
  x = a;
  v = b - a;
  ans += x;
  k -= x;
  if (k < v) {
    puts("-1");
    return;
  } else if (k == v) {
    ans += (k - (k & 1));
  } else {
    if (v & 1)
      ans += (k - 1);
    else {
      if (k & 1) {
        ans += k - 2;
      } else
        ans += k;
    }
  }
  printf("%lld\n", ans);
}
int main() {
  int t = _I();
  while (t--) lipu_mira();
  return 0;
}
