Mikhail walks on a Cartesian plane. He starts at the point $(0, 0)$, and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point $(0, 0)$, he can go to any of the following points in one move:   $(1, 0)$;  $(1, 1)$;  $(0, 1)$;  $(-1, 1)$;  $(-1, 0)$;  $(-1, -1)$;  $(0, -1)$;  $(1, -1)$. 

If Mikhail goes from the point $(x1, y1)$ to the point $(x2, y2)$ in one move, and $x1 \ne x2$ and $y1 \ne y2$, then such a move is called a diagonal move.

Mikhail has $q$ queries. For the $i$-th query Mikhail's target is to go to the point $(n_i, m_i)$ from the point $(0, 0)$ in exactly $k_i$ moves. Among all possible movements he want to choose one with the maximum number of diagonal moves. Your task is to find the maximum number of diagonal moves or find that it is impossible to go from the point $(0, 0)$ to the point $(n_i, m_i)$ in $k_i$ moves.

Note that Mikhail can visit any point any number of times (even the destination point!).


-----Input-----

The first line of the input contains one integer $q$ ($1 \le q \le 10^4$) — the number of queries.

Then $q$ lines follow. The $i$-th of these $q$ lines contains three integers $n_i$, $m_i$ and $k_i$ ($1 \le n_i, m_i, k_i \le 10^{18}$) — $x$-coordinate of the destination point of the query, $y$-coordinate of the destination point of the query and the number of moves in the query, correspondingly.


-----Output-----

Print $q$ integers. The $i$-th integer should be equal to -1 if Mikhail cannot go from the point $(0, 0)$ to the point $(n_i, m_i)$ in exactly $k_i$ moves described above. Otherwise the $i$-th integer should be equal to the the maximum number of diagonal moves among all possible movements.


-----Example-----
Input
3
2 2 3
4 3 7
10 1 9

Output
1
6
-1



-----Note-----

One of the possible answers to the first test case: $(0, 0) \to (1, 0) \to (1, 1) \to (2, 2)$.

One of the possible answers to the second test case: $(0, 0) \to (0, 1) \to (1, 2) \to (0, 3) \to (1, 4) \to (2, 3) \to (3, 2) \to (4, 3)$.

In the third test case Mikhail cannot reach the point $(10, 1)$ in 9 moves.

Difficulty: MEDIUM_HARD

Solutions:
n = int(input())
ar = []
for i in range(n):
	ar.append(list(map(int, input().split())))
for i in range(n):
	k = ar[i][2]
	if max(ar[i]) > ar[i][2]:
		print(-1)
		continue
	elif max(ar[i]) <= ar[i][2]:
		if ar[i][0] % 2 == 0 and ar[i][1] % 2 != 0 or (ar[i][0] % 2 != 0 and ar[i][1] % 2 == 0):
			print(k - 1)
			continue
		elif ar[i][0] % 2 == 0 and ar[i][1] % 2 == 0:
			if k % 2 == 0:
				print(k)
			else:
				print(k - 2)
			continue
		elif ar[i][0] % 2 != 0 and ar[i][1] % 2 != 0:
			if k % 2 == 0:
				print(k - 2)
			else:
				print(k)
			continue


q = int(input())
otvet = []
for i in range(q):
	g = input().split()
	n = int(g[0])
	m = int(g[1])
	k = int(g[2])
	if n < 0:
		n = -n
	if m < 0:
		m = -m
	if m > k or n > k:
		otvet.append(-1)
	elif m % 2 == k % 2 and n % 2 == k % 2:
		otvet.append(k)
	elif m % 2 == k % 2 or n % 2 == k % 2:
		otvet.append(k - 1)
	else:
		otvet.append(k - 2)
for i in otvet:
	print(i)


n = int(input())
for i in range(n):
	(x, y, k) = list(map(int, input().split()))
	if y > x:
		(x, y) = (y, x)
	if x > k or y > k:
		print(-1)
	else:
		o = y
		k = k - y
		x = x - y
		if x % 2 == 1:
			print(o + (k - 1))
		elif k % 2 == 0:
			print(o + k)
		else:
			print(o + (k - 2))


q = int(input())
r = []
for _ in range(q):
	(a, b, k) = [abs(int(x)) for x in input().split()]
	line = min(a, b)
	if k < max(a, b):
		r.append(-1)
	elif abs(a - b) % 2 == 1:
		r.append(k - 1)
	elif (k - line) % 2 == 1:
		r.append(k - 2)
	else:
		r.append(k)
list(map(print, r))


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	p = min(m, n)
	r = max(n, m) - p
	if p + r > k:
		print(-1)
	elif r % 2 == 1:
		print(k - 1)
	elif (k - p) % 2 == 0:
		print(k)
	else:
		print(k - 2)


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	if n % 2 != m % 2:
		(k, n) = (k - 1, n - 1)
	elif n % 2 != k % 2:
		(n, m) = (n - 1, m - 1)
		k -= 2
	if n > k:
		print(-1)
	else:
		print(k)


n = int(input())
for j in range(n):
	(a, b, c) = map(int, input().split())
	ost = min(a, b)
	ost1 = max(a, b) - ost
	if ost + ost1 > c:
		print(-1)
		continue
	if abs(a - b) % 2 != 0:
		print(c - 1)
	elif (ost1 + ost) % 2 == c % 2:
		print(c)
	else:
		print(c - 2)


def m():
	[x, y, k] = [int(i) for i in input().split()]
	d = min(x, y)
	x -= d
	y -= d
	k -= d
	if k - x - y < 0:
		print(-1)
	else:
		x += y
		if x % 2 > 0 and k % 2 > 0:
			print(d + k - 1)
		elif x % 2 > 0:
			print(d + k - 1)
		elif k % 2 > 0:
			print(d + k - 2)
		else:
			print(d + k)
n = int(input())
for i in range(n):
	m()


nq = int(input())
for _ in range(nq):
	(a, b, k) = [int(i) for i in input().split(' ')]
	s = 0
	flag = 0
	s = min(a, b)
	remain = k - min(a, b)
	if remain < 0:
		flag = 1
	dis = max(a, b) - min(a, b)
	if dis % 2 == 1:
		e = dis // 2
		s += e * 2
		remain = remain - e * 2
		if remain < 0:
			flag = 1
		s += remain - 1
	else:
		e = dis // 2
		s += e * 2
		remain = remain - 2 * e
		if remain < 0:
			flag = 1
		if remain == 1:
			s = s - 1
		elif remain % 2 == 1:
			remain -= 3
			if remain < 0:
				flag = 1
			s += 1
			s += remain
		else:
			s += remain
	if flag == 1 or max(a, b) > k:
		print(-1)
	else:
		print(s)


q = input()
q = int(q)
for i in range(q):
	a = input()
	a = list(a.split(' '))
	for j in range(3):
		a[j] = int(a[j])
	d = 0
	moves = 0
	if a[0] < a[1]:
		(a[0], a[1]) = (a[1], a[0])
	d = a[1]
	a[0] -= a[1]
	k = a[2]
	d += a[0] // 2 * 2
	moves = d
	a[0] = a[0] % 2
	k -= moves
	if a[0] > 0 and k <= 0:
		print(-1)
		continue
	if k < 0:
		print(-1)
		continue
	if a[0] == 0:
		if k % 2 == 0:
			d += k
		else:
			d += k - 2
	else:
		d += k - 1
	print(d)


q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	if max([n, m]) > k:
		print(-1)
	elif (n + m) % 2 == 0:
		if max([n, m]) % 2 != k % 2:
			print(k - 2)
		else:
			print(k)
	else:
		print(k - 1)


q = int(input())
for i in range(q):
	(x, y, k) = map(int, input().split())
	ans = 0
	if max(x, y) > k:
		ans = -1
	elif x % 2 == 0 and y % 2 == 0:
		if k % 2 == 0:
			ans = k
		else:
			ans = k - 2
	elif x % 2 == 1 and y % 2 == 1:
		if k % 2 == 0:
			ans = k - 2
		else:
			ans = k
	else:
		ans = k - 1
	print(ans)


q = int(input())
for i in range(q):
	(x, y, k) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	m = y
	d = y
	if (y - x) % 2 == 1:
		d -= 1
	if k < m:
		print(-1)
		continue
	r = k - m
	if r % 2 != 0:
		r -= 1
		if d != m:
			d += 1
		else:
			d -= 1
	d += r
	print(d)


import math
from collections import defaultdict as dd
import heapq
for _ in range(int(input())):
	(x, y, k) = [int(i) for i in input().split(' ')]
	if max(x, y) > k:
		print(-1)
	elif (x + y) % 2:
		print(k - 1)
	else:
		r = k - max(x, y)
		if r % 2 == 0:
			print(k)
		else:
			print(k - 2)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, m, k) = ria()
		d = min(n, m)
		bachein = max(n, m) - min(n, m)
		c = 0
		if bachein % 2 == 0:
			d += bachein
		else:
			d += bachein - 1
			c = 1
		op = max(n, m)
		if op > k:
			wi(-1)
		else:
			abkitnabacha = k - op
			if c:
				abkitnabacha += 1
				d += abkitnabacha - 1
			else:
				if abkitnabacha % 2 == 1:
					abkitnabacha -= 2
				d += abkitnabacha
			wi(d)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, **kwargs, file=sys.stderr)
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(Q,) = getIntList()
for _ in range(Q):
	(N, M, K) = getIntList()
	if max(N, M) > K:
		print(-1)
		continue
	r = K
	if N % 2 != K % 2:
		r -= 1
	if M % 2 != K % 2:
		r -= 1
	print(r)


USE_STDIO = False
if not USE_STDIO:
	try:
		import mypc
	except:
		pass

def main():
	(q,) = map(int, input().split(' '))
	for _ in range(q):
		(n, m, k) = map(int, input().split(' '))
		if n > k or m > k:
			print(-1)
		elif (n - m) % 2:
			print(k - 1)
		elif (n - k) % 2:
			print(k - 2)
		else:
			print(k)
main()


q = int(input())
Q = [list(map(int, input().split())) for i in range(q)]
for (n, m, k) in Q:
	if n > k or m > k:
		print(-1)
		continue
	x = max(n, m) - min(n, m)
	y = k - max(n, m)
	if x % 2 == 0 and y % 2 == 0:
		print(k)
	elif x % 2 == 0 and y % 2 == 1:
		print(k - 2)
	elif x % 2 == 1 and y % 2 == 0:
		print(k - 1)
	elif x % 2 == 1 and y % 2 == 1:
		print(k - 1)


s = ''
q = int(input())
for k in range(q):
	ch = input()
	l = ch.split()
	(a, b, k) = (int(l[0]), int(l[1]), int(l[2]))
	(a, b) = (max(a, b), min(a, b))
	if k < a:
		s += ' -1'
	elif (k - a) % 2 == 0 and (a - b) % 2 == 0:
		s += ' ' + str(k)
	elif (a - b) % 2 == 0 and (a - k) % 2 == 1:
		s += ' ' + str(k - 2)
	else:
		s += ' ' + str(k - 1)
m = s.split()
for k in m:
	print(k)


q = int(input())
for t in range(q):
	(n, m, k) = map(int, input().split())
	if n > k or m > k:
		print('-1')
	else:
		print(k - (k - n) % 2 - (k - m) % 2)


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	if k < n or k < m:
		print(-1)
	elif abs(m - n) % 2 == 0:
		ans = max(m, n)
		k = k - max(m, n)
		if k % 2 == 0:
			ans += k
		else:
			ans += k - 2
		print(ans)
	else:
		print(k - 1)


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = k - m
	b = k - n
	c = n + m - k
	if a < 0 or b < 0:
		print(-1)
		continue
	c += a + b - a % 2 - b % 2
	print(c)


n = int(input())
for i in range(n):
	(n, m, k) = list(map(int, input().split()))
	if max(n, m) > k:
		print(-1)
	else:
		a = max(n, m) - min(n, m)
		b = max(m, n)
		if a == 0:
			if (k - b) % 2 == 0:
				print(k)
			else:
				print(k - 2)
		elif a == 1:
			print(k - 1)
		elif a % 2 != 0:
			print(k - 1)
		elif (k - b) % 2 == 0:
			print(k)
		else:
			print(k - 2)


def fun(n, m, k):
	(n1, m1) = (min(n, m), min(n, m))
	(n2, m2) = (max(n, m), max(n, m))
	(mov1, mov2, mov3) = (0, 0, -1)
	if n + m & 1 == 0:
		(n3, m3) = ((n + m) // 2, (n + m) // 2)
		mov3 = n3 + abs(n - n3)
	mov1 = n1
	mov2 = n2
	(f1, f2, f3) = (0, 0, 0)
	ma = -1
	if mov1 + abs(n - n1) + abs(m - m1) <= k:
		f1 = 1
		k1 = k - mov1 - (abs(n - n1) + abs(m - m1))
		if k1 & 1 == 0:
			mov1 += k1
		else:
			mov1 += k1 - 2
	if mov2 + abs(n - n2) + abs(m - m2) <= k:
		f2 = 1
		k2 = k - mov2 - (abs(n - n2) + abs(m - m2))
		if k2 & 1 == 0:
			mov2 += k2
		else:
			mov2 += k2 - 2
	if n + m & 1 == 0 and mov3 <= k:
		f3 = 1
		k3 = k - mov3
		if k3 & 1 == 0:
			mov3 += k3
		else:
			mov3 += k3 - 2
	if f1 == 1:
		ma = max(ma, mov1)
	if f2 == 1:
		ma = max(ma, mov2)
	if f3 == 1:
		ma = max(ma, mov3)
	return ma
import sys
f = sys.stdin
out = sys.stdout
q = int(f.readline().rstrip('\r\n'))
for i in range(q):
	ma = -1
	(n, m, k) = map(int, f.readline().rstrip('\r\n').split())
	ma = max(ma, fun(n, m, k))
	ma = max(ma, fun(n - 1, m, k - 1))
	ma = max(ma, fun(n, m - 1, k - 1))
	ma = max(ma, fun(n + 1, m, k - 1))
	ma = max(ma, fun(n, m + 1, k - 1))
	z = fun(n - 1, m + 1, k - 1)
	if z >= 0:
		ma = max(ma, z + 1)
	z = fun(n + 1, m - 1, k - 1)
	if z >= 0:
		ma = max(ma, z + 1)
	z = fun(n - 1, m - 1, k - 1)
	if z >= 0:
		ma = max(ma, z + 1)
	out.write(str(ma) + '\n')


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	mx = max(n, m)
	if mx > k:
		print(-1)
		continue
	ab = abs(n - m)
	if ab % 2 == 0:
		if (k - mx) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	else:
		print(k - 1)


q = int(input())
for i in range(q):
	(x, y, k) = map(int, input().split())
	if x > y:
		t = x
		x = y
		y = t
	k -= x
	y -= x
	ans = x
	if k < y:
		print(-1)
	else:
		if y % 2 == 0:
			if k % 2 == 0:
				ans += k
			else:
				ans += k - 2
		else:
			ans += k - 1
		print(ans)


q = int(input())
for i in range(q):
	(n, m, k) = list(map(int, input().split()))
	if n > k or m > k:
		print(-1)
	elif n % 2 == 0 and m % 2 == 0:
		if k % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif n % 2 == 0 and m % 2 == 1 or (n % 2 == 1 and m % 2 == 0):
		print(k - 1)
	elif n % 2 == 1 and m % 2 == 1:
		if k % 2 == 0:
			print(k - 2)
		else:
			print(k)


n = int(input())
for i in range(n):
	(x, y, k) = map(int, input().split())
	lazem = max(x, y)
	if k < lazem:
		print(-1)
	elif x % 2 == 0 and y % 2 == 0:
		if k % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif x % 2 == 1 and y % 2 == 1:
		if k % 2 == 1:
			print(k)
		else:
			print(k - 2)
	else:
		print(k - 1)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	if n % 2 != m % 2:
		k -= 1
		n -= 1
	elif n % 2 != k % 2:
		k -= 2
		n -= 1
		m -= 1
	print(-1 if k < n else k)


n = int(input())
for i in range(n):
	(a, b, c) = [int(el) for el in input().split()]
	if a > c or b > c:
		print(-1)
	elif a % 2 + b % 2 == 1:
		print(c - 1)
	elif a % 2 == b % 2 == c % 2:
		print(c)
	else:
		print(c - 2)


q = int(input())
for i in range(q):
	(x, y, n) = map(int, input().split())
	shortest = max(x, y)
	if shortest > n:
		print('-1')
	else:
		dist = (x + y) % 2
		n -= dist
		left = n - shortest + dist
		if left % 2 == 0:
			print(n)
		elif left == 1:
			if dist == 1:
				print(shortest)
			else:
				print(shortest - 1)
		elif dist == 1:
			print(shortest + left - 1)
		else:
			print(shortest + left - 2)


q = int(input().rstrip())
n = [0] * q
m = [0] * q
k = [0] * q
for _ in range(q):
	(n, m, k) = map(int, input().rstrip().split(' '))
	if n < m:
		(n, m) = (m, n)
	if k < n:
		print(-1)
		continue
	if n % 2 != m % 2:
		k -= 1
		n -= 1
	elif n % 2 != k % 2:
		k -= 2
		n -= 1
		m -= 1
	print(k)


for i in range(int(input())):
	(n, m, k) = list(map(int, input().split()))
	print(-1 if max(n, m) > k else k - int(1 if (n + m) % 2 else (n % 2 + k % 2) % 2 * 2))


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	if (n + m) % 2 == 0:
		if max(n, m) > k:
			print(-1)
			continue
		r = k - max(n, m)
		cnt = max(n, m)
		if r % 2 == 0:
			cnt += r
		else:
			cnt -= 1
			cnt += r - 1
		print(cnt)
	else:
		if max(n, m) - 1 + 1 > k:
			print(-1)
			continue
		r = k - (max(n, m) - 1 + 1)
		cnt = max(n, m) - 1
		if r % 2 == 0:
			cnt += r
		else:
			cnt += r
		print(cnt)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	(n, m) = (abs(n), abs(m))
	(mx, mn) = (max(n, m), min(n, m))
	if mx > k:
		print(-1)
	elif mx - mn > 0:
		if (mx - mn) % 2 == 0:
			if (k - mx) % 2 == 0:
				print(k)
			else:
				print(k - 2)
		else:
			print(k - 1)
	elif (k - mx) % 2 == 0:
		print(k)
	else:
		print(k - 2)


import sys
n = int(next(sys.stdin))
for line in sys.stdin:
	(n, m, k) = map(int, line.split())
	if max(n, m) > k:
		print(-1)
	else:
		if n > m:
			(n, m) = (m, n)
		if (m - n) % 2 == 1:
			print(k - 1)
		elif (k - m) % 2 == 1:
			print(k - 2)
		else:
			print(k)


import functools
import time
from collections import Counter

def timer(func):

	@functools.wraps(func)
	def wrapper(*args, **kwargs):
		stime = time.perf_counter()
		res = func(*args, **kwargs)
		elapsed = time.perf_counter() - stime
		print(f'{func.__name__} in {elapsed:.4f} secs')
		return res
	return wrapper

class solver:

	def __init__(self):
		pass

	def __call__(self):
		q = int(input())
		ans = list()
		for _ in range(q):
			(x, y, k) = map(int, input().strip().split())
			l = max(x, y)
			r = k - l
			if r < 0:
				ans.append(-1)
			else:
				s = x + y
				if s % 2 == 0:
					if r % 2 == 0:
						ans.append(k)
					else:
						ans.append(k - 2)
				else:
					ans.append(k - 1)
		for e in ans:
			print(e)
solver()()


from sys import stdin
n = int(stdin.readline().strip())
for i in range(n):
	(a, b, c) = map(int, stdin.readline().strip().split())
	x = max(a, b)
	z = min(a, b)
	if (a + b) % 2 == 0:
		ans = 0
		ans += x
		y = c - x
		if y < 0:
			print(-1)
			continue
		ans += y
		if y % 2 != 0:
			ans -= 2
		print(ans)
	else:
		if c < x:
			print(-1)
			continue
		print(c - 1)


n = int(input())
for i in range(n):
	(n, m, k) = [int(j) for j in input().split()]
	if n < m:
		(n, m) = (m, n)
	if n & 1 != m & 1:
		k -= 1
		n -= 1
	elif n & 1 != k & 1:
		k -= 2
		n -= 1
		m -= 1
	if k < n:
		print(-1)
	else:
		print(k)


t = int(input())
while t:
	t -= 1
	(n, m, k) = map(int, input().split())
	(n, m) = (min(n, m), max(n, m))
	if k < m:
		print(-1)
	elif n == m:
		if (k - n) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	else:
		ans = n
		k -= n
		if (m - n) % 2 == 0:
			ans += m - n
			k -= m - n
			if k % 2 == 0:
				ans += k
			else:
				ans += k - 2
		else:
			ans += m - n - 1
			k -= m - n - 1
			ans += k - 1
		print(ans)


def er(a, b, c):
	if c < max(a, b):
		return -1
	if (a + b) % 2 == 1:
		return c - 1
	if (a + b) % 2 == 0:
		if (a - c) % 2 == 0:
			return c
		else:
			return c - 2
a = int(input())
for i in range(a):
	s = input().split()
	print(er(int(s[0]), int(s[1]), int(s[2])))


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	ost = max(n, m) - min(n, m)
	plus = 0
	if ost % 2 != 0:
		plus = 1
		ost -= 1
	mini = min(n, m) + ost + plus
	if k < mini:
		print(-1)
	elif (k - mini) % 2 == 0 or plus == 1:
		print(k - plus)
	else:
		print(k - plus - 2)


q = int(input())
ans = []
for i in range(q):
	(n, m, k) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	min1 = m
	if min1 > k:
		ans.append(-1)
	elif (n + m) % 2 == 0:
		if (k - min1) % 2 == 1:
			ans.append(k - 2)
		else:
			ans.append(k)
	else:
		ans.append(k - 1)
for i in range(q):
	print(ans[i])


n = int(input())
for i in range(n):
	(a, b, k) = map(int, input().split())
	a = abs(a)
	b = abs(b)
	nado = max(a, b)
	if nado > k:
		print(-1)
	else:
		d = min(a, b)
		if (nado - d) % 2 == 0 and (k - nado) % 2 == 0:
			print(k)
		elif (nado - d) % 2 == 0:
			print(k - 2)
		else:
			print(k - 1)


q = []
n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	g = c % 2
	if abs(a) > c or abs(b) > c:
		q.append(-1)
	elif g == a % 2 and g == b % 2:
		q.append(c)
	elif g != a % 2 and g != b % 2:
		q.append(c - 2)
	else:
		q.append(c - 1)
for i in range(n):
	print(q[i])


q = int(input())
for tmp in range(q):
	(n, m, k) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	if m > k:
		print(-1)
	else:
		ans = n
		k -= n
		r = m - n
		if r % 2 == 1:
			ans += r - 1
			k -= r - 1
			r = 1
		else:
			ans += r
			k -= r
			r = 0
		if r == 0:
			if k % 2 == 0:
				ans += k
			else:
				ans += k - 2
		elif k % 2 == 0:
			ans += k - 1
		else:
			ans += k - 1
		print(ans)


q = int(input())
for t in range(q):
	result = None
	(n, m, k) = list(map(int, input().split()))
	min_move = max(n, m)
	if k < min_move:
		result = -1
	elif n == m:
		if m == k:
			result = n
		else:
			if n % 2 == 0 and k % 2 == 0:
				result = k
			if n % 2 == 0 and k % 2 == 1:
				result = k - 2
			if n % 2 == 1 and k % 2 == 1:
				result = k
			if n % 2 == 1 and k % 2 == 0:
				result = k - 2
	elif n % 2 == 1 and m % 2 == 1 and (k % 2 == 1):
		result = k
	elif n % 2 == 0 and m % 2 == 0 and (k % 2 == 0):
		result = k
	elif n % 2 == 0 and m % 2 == 0 and (k % 2 == 1):
		result = k - 2
	elif n % 2 == 1 and m % 2 == 1 and (k % 2 == 0):
		result = k - 2
	else:
		result = k - 1
	print(result)


q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	if n > k or m > k:
		print(-1)
		continue
	ans = k
	if k % 2 == 0:
		if n % 2 == 1:
			ans -= 1
		if m % 2 == 1:
			ans -= 1
	else:
		if n % 2 == 0:
			ans -= 1
		if m % 2 == 0:
			ans -= 1
	print(ans)


Q = int(input())
src = [tuple(map(int, input().split())) for i in range(Q)]
ans = []
for (x, y, k) in src:
	d = max(x, y)
	if (x + y) % 2:
		ans.append(-1 if d > k else k - 1)
	elif d > k:
		ans.append(-1)
	else:
		ans.append(k - 2 if (d + k) % 2 else k)
print(*ans, sep='\n')


n = int(input())

def process(x, y, steps):
	x = abs(x)
	y = abs(y)
	diag = min(x, y)
	metric = max(x, y)
	delta = metric - diag
	if metric > steps:
		return -1
	else:
		temp = steps - metric
		if temp % 2 == 1:
			return diag - 1 + (steps - diag) // 2 * 2
		else:
			return diag + (steps - diag) // 2 * 2
for i in range(n):
	(x, y, steps) = [int(n) for n in input().split()]
	print(process(x, y, steps))


q = int(input())
for e in range(q):
	(x, y, k) = map(int, input().split())
	(x, y) = (abs(x), abs(y))
	(x, y) = (max(x, y), min(x, y))
	if x % 2 != k % 2:
		k -= 1
		y -= 1
	if x > k:
		print(-1)
		continue
	if (x - y) % 2:
		k -= 1
		x -= 1
	print(k)


for i in range(int(input())):
	num = 0
	(x, y, k) = map(int, input().split())
	if k < max(x, y):
		print(-1)
		continue
	if x == y:
		if (y ^ k) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif abs(x - y) % 2 != 0:
		print(k - 1)
	elif (max(x, y) ^ k) % 2 == 0:
		print(k)
	else:
		print(k - 2)


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)
for _ in range(int(input())):
	(x, y, k) = map(int, input().split())
	(x, y) = (abs(x), abs(y))
	r = max(x, y)
	if k < r:
		print(-1)
	elif x % 2 == y % 2:
		if (k - r) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	else:
		print(k - 1)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n, m, k) = I()
	mi = min(n, m)
	ma = max(n, m)
	if k < ma:
		print(-1)
	else:
		d = mi
		rem = k - d
		tob = ma - d
		if rem % 2 == 0 and tob % 2 == 0:
			print(k)
		elif tob % 2:
			print(k - 1)
		else:
			print(k - 2)


def r15(n, m, k, diff, ans):
	if diff < 0:
		print(-1)
	else:
		if n % 2 == 0 and m % 2 == 0 or (n % 2 != 0 and m % 2 != 0):
			if diff % 2 == 0:
				ans += diff
			else:
				ans += diff - 2
		else:
			ans += diff - 1
		print(ans)

def inp():
	q = int(input())
	return q

def threeinput():
	(n, m, k) = map(int, input().split())
	return (n, m, k)
for i in range(inp()):
	(n, m, k) = threeinput()
	ans = max(n, m)
	diff = k - ans
	r15(n, m, k, diff, ans)


def main():
	q = int(input())
	for i in range(q):
		(n, m, k) = map(int, input().split())
		if k < max(n, m):
			print(-1)
			continue
		(nn, mm) = (n + (k - n) // 2 * 2, m + (k - m) // 2 * 2)
		(left, right) = (-1, min(nn, mm) + 1)
		while 1 < right - left:
			mid = (left + right) // 2
			t = nn + mm - mid
			if t < k:
				right = mid
			else:
				left = mid
		if nn + mm - left == k:
			print(left)
		else:
			print(-1)
main()


q = int(input())
for _ in range(q):
	(x, y, k) = [int(x) for x in input().split()]
	dm = min(x, y)
	nm = max(x, y) - dm
	if nm % 2 == 0:
		dm += nm
		nm = 0
	else:
		dm += nm - 1
		nm = 1
	if nm + dm > k:
		print(-1)
		continue
	if nm + dm == k:
		print(dm)
		continue
	d = k - nm - dm
	if d % 2 == 0:
		print(dm + d)
	elif nm > 0:
		print(dm + d)
	else:
		print(dm - 2 + d)


q = int(input())
x = []
y = []
k = []
for i in range(q):
	(z, v, c) = [int(el) for el in input().split()]
	x.append(z)
	y.append(v)
	k.append(c)
for i in range(len(k)):
	if x[i] > k[i] or y[i] > k[i]:
		print(-1)
		continue
	if (k[i] - x[i]) % 2 == 0:
		lx = k[i]
		if (k[i] - y[i]) % 2 == 0:
			out = lx
		else:
			out = lx - 1
	else:
		lx = k[i] - 1
		if (lx - y[i]) % 2 != 0:
			out = lx
		else:
			out = lx - 1
	print(out)


q = int(input())
for i in range(q):
	(n, m, k) = map(int, input().split())
	ans = max(n, m)
	diff = k - ans
	if diff < 0:
		print(-1)
	else:
		if n % 2 == 0 and m % 2 == 0 or (n % 2 != 0 and m % 2 != 0):
			if diff % 2 == 0:
				ans += diff
			else:
				ans += diff - 2
		else:
			ans += diff - 1
		print(ans)


q = int(input())
for i in range(q):
	(x, y, k) = map(int, input().split())
	if abs(x) == abs(y) and k == abs(x) + 1:
		print(abs(x) - 1)
		continue
	smth = min(abs(x), abs(y))
	ans = smth
	if smth + (abs(x) - smth) + abs(y) - smth > k:
		print('-1')
	else:
		k -= ans
		a = max(x, y)
		a -= min(x, y)
		if k == 1:
			print(ans)
		elif a % 2 == 1 and k % 2 == 0:
			print(ans + k - 1)
		elif a % 2 == 1 and k % 2 == 1:
			print(ans + (k - 1))
		elif a % 2 == 0 and k % 2 == 0:
			print(ans + k)
		elif a % 2 == 0 and k % 2 == 1:
			print(ans + k - 2)


for _ in range(int(input())):
	(x, y, c) = map(int, input().split())
	if x + y - min(x, y) > c:
		print(-1)
	else:
		print(c - (c - x) % 2 - (c - y) % 2)


import sys
from array import array

def readline():
	return sys.stdin.buffer.readline().decode('utf-8')
q = int(readline())
ans = [-1] * q
for i in range(q):
	(n, m, k) = map(int, readline().split())
	if max(n, m) > k:
		continue
	if n > m:
		(n, m) = (m, n)
	if k & 1 != n & 1 and k & 1 != m & 1:
		ans[i] = k - 2
	if k & 1 == n & 1 or k & 1 == m & 1:
		ans[i] = k - 1
	if k & 1 == n & 1 == m & 1:
		ans[i] = k
print(*ans, sep='\n')


k = int(input())
for i in range(k):
	(n, m, k) = map(int, input().split())
	n = abs(n)
	m = abs(m)
	if n > k or m > k:
		print('-1')
	else:
		a = (n - k) % 2 + (m - k) % 2
		print(k - a)


n = int(input())
for v in range(n):
	(n, m, k) = map(int, input().split())
	if max(abs(n), abs(m)) > k:
		print(-1)
	else:
		if (abs(n) + abs(m)) % 2:
			d = k - 1
		elif max(abs(n), abs(m)) % 2 == k % 2:
			d = k
		else:
			d = k - 2
		print(d)


n = int(input())
for i in range(n):
	(x, y, k) = map(lambda x: abs(int(x)), input().split(' '))
	(x, y) = (min(x, y), max(x, y))
	minstep = y
	ans = 0
	if k < minstep:
		ans = -1
	else:
		ans += x
		k -= x
		if x == y:
			if k % 2 == 1:
				ans -= 1
				k -= 1
			ans += k
		elif (y - x) % 2 == 1:
			y -= 1
			k -= 1
			ans += k
		elif k % 2 == 0:
			ans += k
		else:
			ans += k - 2
	print(ans)


from sys import exit
n = int(input())
for i in range(n):
	(x, y, k) = map(int, input().split())
	d = max(x, y)
	if d > k:
		print(-1)
		continue
	q = 0
	if (x + y) % 2:
		k -= 1
		print(k)
		continue
	if (k - d) % 2:
		print(k - 2)
	else:
		print(k)


q = int(input())
for i in range(0, q):
	(a, b, c) = map(int, input().split())
	a = abs(a)
	b = abs(b)
	if c < a or c < b:
		print(-1)
	else:
		print(c - (a - c) % 2 - (b - c) % 2)


q = int(input())
while q > 0:
	(n, m, k) = map(int, input().split())
	if n < m:
		(n, m) = (m, n)
	if n % 2 != m % 2:
		k -= 1
		n -= 1
	elif n % 2 != k % 2:
		k -= 2
		n -= 1
		m -= 1
	print(-1 if k < n else k)
	q -= 1


import sys, math
q = int(sys.stdin.readline())
for loop in range(q):
	(x, y, k) = map(int, sys.stdin.readline().split())
	if k % 2 == 0:
		if x % 2 == 0 and y % 2 == 0:
			if abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
				print(k)
			else:
				print(-1)
		elif x % 2 == 1 and y % 2 == 1:
			if x > y:
				x -= 1
				y += 1
			elif x == y:
				x -= 1
				y -= 1
			else:
				x += 1
				y -= 1
			if 2 + abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
				print(k - 2)
			else:
				print(-1)
		else:
			if x > y:
				x -= 1
			else:
				y -= 1
			if 1 + abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
				print(k - 1)
			else:
				print(-1)
	elif x % 2 == 0 and y % 2 == 0:
		if x > y:
			x -= 1
			y += 1
		elif x == y:
			x -= 1
			y -= 1
		else:
			x += 1
			y -= 1
		if 2 + abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
			print(k - 2)
		else:
			print(-1)
	elif x % 2 == 1 and y % 2 == 1:
		if abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
			print(k)
		else:
			print(-1)
	else:
		if x >= y:
			x -= 1
		else:
			y -= 1
		if 1 + abs(x - y) // 2 + (max(x, y) - abs(x - y) // 2) <= k:
			print(k - 1)
		else:
			print(-1)


def go():
	n = int(input())
	for i in range(n):
		(a, b, d) = [int(i) for i in input().split(' ')]
		if a > d or b > d:
			print(-1)
		elif a % 2 == b % 2:
			if a % 2 == d % 2:
				print(d)
			else:
				print(d - 2)
		elif a % 2 == b % 2:
			if d % 2 == a % 2:
				print(d)
			else:
				print(d - 2)
		else:
			print(d - 1)
go()


q = int(input())
for _ in range(q):
	(n, m, k) = list(map(int, input().split()))
	if k == 0:
		if n == 0 and m == 0:
			print(0)
		else:
			print(-1)
	elif k == 1:
		if max(abs(n), abs(m)) != 1:
			print(-1)
		elif abs(n) == abs(m) == 1:
			print(1)
		else:
			print(0)
	elif max(abs(n), abs(m)) > k:
		print(-1)
	elif abs(n) == abs(m):
		if (k - abs(n)) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif (max(abs(n), abs(m)) - min(abs(n), abs(m))) % 2 == 0:
		if (k - max(abs(n), abs(m))) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	else:
		print(k - 1)


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(n, m, k) = [int(i) for i in input().split()]
	dis = n + m
	if k < max(n, m):
		print(-1)
		continue
	if dis % 2 == 0:
		diag = max(n, m)
		rem = k - diag
		if rem % 2 == 0:
			print(diag + rem)
		else:
			diag = diag - 1
			rem = k - (diag + 2)
			print(diag + rem)
	else:
		diag = max(n, m)
		rem = k - diag
		print(diag + rem - 1)


from sys import stdin, stdout
import cProfile
printHeap = str()
test = False
memory_constrained = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def main():
	for w in range(get_int()):
		(x, y, k) = get_tuple()
		if k < max(x, y):
			display('-1')
			continue
		if (x + y) % 2 == 0:
			smlst = max(x, y)
			extra = k - smlst
			if extra % 2 == 0:
				digonal = k
			else:
				digonal = smlst + extra - 2
		else:
			digonal = k - 1
		display(digonal)
cProfile.run('main()') if test else main()


q = int(input())
(x, y, z) = ([], [], [])
for i in range(q):
	(a, b, c) = map(int, input().split(' '))
	x.append(a)
	y.append(b)
	z.append(c)
for i in range(q):
	m = max(x[i], y[i])
	if m > z[i]:
		print(-1)
		continue
	if x[i] % 2 == 0 and y[i] % 2 == 0:
		if z[i] % 2 == 0:
			print(z[i])
		else:
			print(z[i] - 2)
	elif x[i] % 2 != 0 and y[i] % 2 != 0:
		if z[i] % 2 == 0:
			print(z[i] - 2)
		else:
			print(z[i])
	else:
		print(z[i] - 1)


import math
q = int(input())
for i in range(q):
	(x, y, k) = map(int, input().split())
	if x > k or y > k:
		print(-1)
	elif (x + y) % 2 == 0:
		if (k - max(x, y)) % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif (k - max(x, y)) % 2 == 0:
		print(k - 1)
	else:
		print(k - 1)


for i in range(int(input())):
	l = 0
	(x, y, k) = list(map(int, input().split()))
	if (x - y) % 2 != 0:
		l = 1
	across = max(abs(x), abs(y)) - l
	k -= max(abs(x), abs(y))
	if k < 0 or (across == 0 and k % 2 == 1):
		print(-1)
	elif l == 1:
		print(k + max(abs(x), abs(y)) - l)
	else:
		print(across + k - 2 * (k % 2))


a = int(input())
for i in range(a):
	line = [int(j) for j in input().split()]
	d = max(line[0], line[1])
	if line[2] < d:
		print(-1)
	elif line[0] & 1 and line[1] & 1 or (line[1] % 2 == 0 and line[0] % 2 == 0):
		if (d - line[2]) % 2 == 0:
			print(line[2])
		else:
			print(line[2] - 2)
	else:
		print(line[2] - 1)


from collections import deque
from sys import stdin
lines = deque((line.strip() for line in stdin.readlines()))

def nextline():
	return lines.popleft()

def types(cast, sep=None):
	return tuple((cast(x) for x in strs(sep=sep)))

def ints(sep=None):
	return types(int, sep=sep)

def strs(sep=None):
	return tuple(nextline()) if sep == '' else tuple(nextline().split(sep=sep))

def main():
	T = int(nextline())
	for testCase in range(1, T + 1):
		(n, m, k) = ints()
		min_k = max(n, m)
		if min_k > k:
			print(-1)
			continue
		if (n - m) % 2 == 0:
			if k % 2 == n % 2:
				print(k)
				continue
			print(k - 2)
			continue
		print(k - 1)

def __starting_point():
	main()
__starting_point()


def solve(n, m, k):
	(n, m) = (max(abs(n), abs(m)), min(abs(n), abs(m)))
	if (n - m) % 2 != 0:
		k -= 1
		n -= 1
	elif (n - k) % 2 != 0:
		n -= 1
		m -= 1
		k -= 2
	if k < n:
		return -1
	else:
		return k
q = int(input())
for case in range(q):
	print(solve(*[int(x) for x in input().split(' ')]))


Cases = int(input())
for c in range(Cases):
	(n, m, k) = map(int, input().split())
	if n > m:
		(n, m) = (m, n)
	if k < m:
		print(-1)
		continue
	if (n + m) % 2 == 1:
		print(k - 1)
	elif (k + m) % 2 == 1:
		print(k - 2)
	else:
		print(k)


q = int(input())
for i in range(q):
	(a, b, k) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a > k:
		print(-1)
	elif a % 2 == b % 2 != k % 2:
		print(k - 2)
	elif (a + b) % 2 != 0:
		print(k - 1)
	else:
		print(k)


for _ in range(0, int(input())):
	(n, m, k) = map(int, input().split())
	n = abs(n)
	m = abs(m)
	if n > k or m > k:
		print(-1)
	else:
		print(k - (n - k) % 2 - (m - k) % 2)


q = int(input())
for _ in range(q):
	(a, b, k) = [abs(int(x)) for x in input().split()]
	line = min(a, b)
	if k < max(a, b):
		print(-1)
	elif abs(a - b) % 2 == 1:
		print(k - 1)
	elif (k - line) % 2 == 1:
		print(k - 2)
	else:
		print(k)


for i in range(int(input())):
	(n, m, k) = map(int, input().split())
	a = max(n, m)
	b = min(n, m)
	c = b
	e = a - b
	d = k - a
	if a > k:
		print(-1)
		continue
	if a == b:
		if d % 2 == 0:
			print(d + c)
		else:
			print(c - 1 + d - 1)
		continue
	if e % 2 == 0 and d % 2 == 0:
		c += d + e
	if e % 2 == 0 and d % 2 != 0:
		c += d + e - 2
	if e % 2 != 0 and d % 2 == 0:
		c += d + e - 1
	if e % 2 != 0 and d % 2 != 0:
		c += d + e - 1
	print(c)


for _ in range(int(input())):
	(x, y, k) = [*map(int, input().split())]
	ans = min(x, y)
	if max(x, y) > k:
		print(-1)
	elif (x + y) % 2 != 0:
		print(k - 1)
	elif x % 2 != k % 2:
		print(k - 2)
	else:
		print(k)


def max_diagonals(x1, y1, k):
	if k < x1 or k < y1:
		return -1
	x0 = 0
	y0 = 0
	n_diag = 0
	if x1 > y1:
		if (x1 - y1) % 2 == 0:
			x0 = x1 - 1
			y0 = y1 - 1
			n_diag = x1 - 1
		else:
			x0 = x1
			y0 = y1 - 1
			n_diag = x1
	if x1 < y1:
		if (y1 - x1) % 2 == 0:
			y0 = y1 - 1
			x0 = x1 - 1
			n_diag = y1 - 1
		else:
			y0 = y1
			x0 = x1 - 1
			n_diag = y1
	if x1 == y1:
		x0 = x1 - 1
		y0 = y1 - 1
		n_diag = x1 - 1
	reste = k - n_diag
	if x0 == x1 - 1 and y0 == y1:
		return n_diag + reste - 1
	if x0 == x1 - 1 and y0 == y1 - 1:
		if reste % 2 == 0:
			return n_diag + reste - 2
		else:
			return n_diag + reste
	if x0 == x1 and y0 == y1 - 1:
		return n_diag + reste - 1
	return -1
q = int(input())
x1 = [0] * q
y1 = [0] * q
k = [0] * q
for i in range(q):
	line = input().split(sep=' ')
	x1[i] = int(line[0])
	y1[i] = int(line[1])
	k[i] = int(line[2])
for i in range(q):
	print(max_diagonals(x1[i], y1[i], k[i]))


from datetime import date
from math import factorial
import functools
from heapq import *
from collections import deque
import collections
import math
from collections import defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
inf = float('inf')

def main():
	q = int(input())
	for i in range(q):
		(n, m, k) = list(map(int, input().split()))
		if n > k or m > k:
			print(-1)
		else:
			print(k - (k - n) % 2 - (k - m) % 2)
main()


q = int(input())
for _ in range(q):
	(x, y, n) = map(int, input().split())
	if x < y:
		(x, y) = (y, x)
	if x > n:
		print(-1)
		continue
	if x % 2 != y % 2:
		n -= 1
	elif x % 2 != n % 2:
		n -= 2
	print(n)


q = int(input())
while q > 0:
	(n, m, k) = map(int, input().split())
	ans = 0
	l = max(n, m)
	lm = min(n, m)
	if l > k:
		ans = -1
	else:
		k -= l
		ans = l + k // 2 * 2
		if (n + m) % 2 > 0:
			if k % 2 == 0:
				ans -= 1
		elif k % 2 > 0:
			ans -= 1
	print(ans)
	q -= 1


q = int(input())
for i in range(q):
	(x, y, k) = input().split()
	x = int(x)
	y = int(y)
	k = int(k)
	maxm = max(x, y)
	minm = min(x, y)
	if k < maxm:
		print(-1)
	elif maxm != minm:
		if (maxm - minm) % 2 == 0 and (k - minm) % 2 == 0:
			ans = k
		elif (maxm - minm) % 2 == 0 and (k - minm) % 2 != 0:
			ans = minm + 1 + (k - 3 - minm)
		elif (maxm - minm) % 2 != 0 and (k - minm) % 2 == 0:
			ans = minm + (k - 1 - minm)
		elif (maxm - minm) % 2 != 0 and (k - minm) % 2 != 0:
			ans = minm + (k - 1 - minm)
		print(ans)
	else:
		if (k - minm) % 2 == 0:
			ans = k
		else:
			ans = k - 2
		print(ans)


t = int(input())
while t > 0:
	(n, m, k) = list(map(int, input().split(' ')))
	if m > n:
		(n, m) = (m, n)
	if n > k:
		print('-1')
		t -= 1
		continue
	if n % 2 != m % 2:
		k -= 1
	elif n % 2 != k % 2:
		k -= 2
	print(k)
	t -= 1


q = int(input())
for i in range(q):
	s = input().split(' ')
	(n, m, k) = (abs(int(s[0])), abs(int(s[1])), int(s[2]))
	(x, y) = (min(n, m), max(n, m))
	if k < y:
		print('-1')
	else:
		res = x
		k -= x
		y -= x
		if y == 0:
			if k % 2 == 1:
				k -= 1
				res -= 1
			res += k
		elif (k - y) % 2 == 0:
			res += k - y % 2
		else:
			res += 1
			k -= 2
			y -= 1
			res += k - y % 2
		print(res)


def solve():
	q = int(input())
	for i in range(0, q):
		query()

def query():
	(n, m, k) = map(int, input().split(' '))
	if k < max(n, m):
		print(-1)
		return
	if (n + m) % 2 == 1:
		print(k - 1)
		return
	elif (k - max(n, m)) % 2 == 0:
		print(k)
	else:
		print(k - 2)
solve()


q = int(input())
for i in range(q):
	(n, m, k) = list(map(int, input().split()))
	(m, n) = (abs(m), abs(n))
	mx = max(m, n)
	remaining = k - mx
	if remaining < 0:
		print(-1)
	elif m == n == 0:
		if k == 1:
			print(-1)
		elif k % 2:
			print(k - 1)
		else:
			print(k)
	elif abs(m - n) % 2 == 0:
		if remaining % 2 == 0:
			print(k)
		else:
			print(k - 2)
	elif not remaining:
		print(k - 1)
	elif remaining % 2 == 0:
		print(k - 1)
	else:
		print(k - 1)


q = int(input())
queries = []
for i in range(0, q):
	nums = [int(s) for s in input().split()]
	n_i = nums[0]
	m_i = nums[1]
	k_i = nums[2]
	queries.append((n_i, m_i, k_i))
for (n_i, m_i, k_i) in queries:
	d = min(n_i, m_i)
	if max(n_i, m_i) > k_i:
		print(-1)
	elif (n_i - m_i) % 2 == 0 and (k_i - d) % 2 == 0:
		print(k_i)
	elif (n_i - m_i) % 2 == 0 and (k_i - d) % 2 == 1:
		print(k_i - 2)
	else:
		print(k_i - 1)


a = int(input())
for i in range(a):
	(n, m, k) = list(map(int, input().split()))
	(b, c) = (0, 0)
	if min(n, m) + abs(n - m) > k:
		print(-1)
	else:
		b = min(n, m)
		c = abs(n - m)
		k = k - b - c
		b = b + c // 2 * 2
		b += k // 2 * 2
		k %= 2
		c %= 2
		if c == 1 and k == 1:
			print(b + 1)
		elif k == 0:
			print(b)
		elif c == 1 or k == 1:
			print(b - 1)
		else:
			print(b)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 998244353

def solve():
	(N, M, K) = getInts()
	N = abs(N)
	M = abs(M)
	dist = max(N, M)
	if dist > K:
		return -1
	non_diag = abs(N - M)
	diag = min(N, M)
	ans = diag + 2 * (non_diag // 2)
	K -= diag + non_diag
	non_diag -= 2 * (non_diag // 2)
	ans += 2 * (K // 2)
	K -= 2 * (K // 2)
	if K and non_diag:
		ans += 1
	elif K:
		ans -= 1
	return ans
for _ in range(getInt()):
	print(solve())


def _1036B(n, m, k):
	n = abs(n)
	m = abs(m)
	if max(n, m) > k:
		return -1
	else:
		diagonal_moves = min(m, n)
		if (max(m, n) - min(m, n)) % 2 != 0:
			diagonal_moves += k - diagonal_moves - 1
		elif (k - diagonal_moves) % 2 == 0:
			diagonal_moves += k - diagonal_moves
		else:
			diagonal_moves += k - diagonal_moves - 2
		return diagonal_moves
number = int(input())
for index in range(number):
	(n, m, k) = list(map(lambda x: int(x), input().split()))
	print(_1036B(n, m, k))


def solve(x, y, k):
	mx = max(x, y)
	if mx > k:
		return -1
	return k - (x - k) % 2 - (y - k) % 2
assert solve(2, 2, 3) == 1
assert solve(4, 3, 7) == 6
assert solve(10, 1, 9) == -1
q = int(input())
for i in range(q):
	print(solve(*map(int, input().split())))


num_tc = int(input())
for tc in range(0, num_tc):
	(x, y, k) = [int(x) for x in input().split()]
	if x > k or y > k:
		print(-1)
	else:
		if (k - x) % 2 == 0:
			t1 = 0
		else:
			t1 = 1
		if (k - y) % 2 == 0:
			t2 = 0
		else:
			t2 = 1
		max_moves = k - (t1 + t2)
		if max_moves < 0:
			print(-1)
		else:
			print(max_moves)


for run in range(int(input())):
	(x, y, step) = map(int, input().split())
	if x > y:
		(x, y) = (y, x)
	minStep = y
	if minStep > step:
		print(-1)
	else:
		restStep = step - minStep
		if restStep % 2 == 0 or (y - x) % 2 == 1:
			print(y - (y - x) % 2 + restStep)
		else:
			print(y - (y - x) % 2 + restStep - 2)


num_queries = int(input())
for _ in range(num_queries):
	(x, y, num_moves) = map(abs, map(int, input().split()))
	if x > num_moves or y > num_moves:
		print('-1')
	else:
		solution = min(x, y)
		x -= solution
		y -= solution
		distance = x + y
		num_moves -= solution
		if distance % 2 == 0:
			if num_moves % 2 == 0:
				solution += num_moves
			else:
				solution += num_moves - 2
		else:
			solution += num_moves - 1
		print(solution)


Q = int(input())
for qi in range(Q):
	(N, M, K) = map(int, input().split())
	if N < M:
		(N, M) = (M, N)
	if N % 2 != M % 2:
		K -= 1
		N -= 1
	elif N % 2 != K % 2:
		K -= 2
		N -= 1
		M -= 1
	print(-1 if K < N else K)