You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.

So the team is considered perfect if it includes at least one coder, at least one mathematician and it consists of exactly three members.

You are a coach at a very large university and you know that $c$ of your students are coders, $m$ are mathematicians and $x$ have no specialization.

What is the maximum number of full perfect teams you can distribute them into? 

Note that some students can be left without a team and each student can be a part of no more than one team.

You are also asked to answer $q$ independent queries.


-----Input-----

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

Each of the next $q$ lines contains three integers $c$, $m$ and $x$ ($0 \le c, m, x \le 10^8$) — the number of coders, mathematicians and students without any specialization in the university, respectively.

Note that the no student is both coder and mathematician at the same time. 


-----Output-----

Print $q$ integers — the $i$-th of them should be the answer to the $i$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into. 


-----Example-----
Input
6
1 1 1
3 6 0
0 0 0
0 1 1
10 1 10
4 4 1

Output
1
3
0
0
1
3



-----Note-----

In the first example here are how teams are formed:  the only team of 1 coder, 1 mathematician and 1 without specialization;  all three teams consist of 1 coder and 2 mathematicians;  no teams can be formed;  no teams can be formed;  one team consists of 1 coder, 1 mathematician and 1 without specialization, the rest aren't able to form any team;  one team consists of 1 coder, 1 mathematician and 1 without specialization, one consists of 2 coders and 1 mathematician and one consists of 1 coder and 2 mathematicians.

Difficulty: EASY
Tags: Sorting

Mathematics
Skill types: Sorting

Starter code:

Solutions:
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	ans = min([c, m, (x + c + m) // 3])
	print(ans)


q = int(input())
for i in range(q):
	(c, m, x) = [int(x) for x in input().split()]
	min = 0
	if c <= m:
		min = c
	else:
		min = m
	if min <= x:
		print(min)
	else:
		r = int((c + m - 2 * x) / 3 + x)
		if r > min:
			print(min)
		else:
			print(r)


t = int(input())

def coders(a, b, c):
	m = min(a, b)
	if m >= (a + b + c) // 3:
		m = (a + b + c) // 3
	return m
for i in range(t):
	(a, b, c) = map(int, input().split())
	print(coders(a, b, c))


q = int(input())
l = []
for _ in range(q):
	l.append(list(map(int, input().split())))
for i in range(q):
	(c, m, x) = l[i]
	if c == 0 or m == 0 or c + m + x < 3:
		print(0)
	else:
		a = min(c, m)
		r1 = min(a, x)
		c = c - r1
		m = m - r1
		r2 = 0
		r2 += min((m + c) // 3, m, c)
		print(r1 + r2)


n = int(input())
for i in range(n):
	(a, b, c) = [int(f) for f in input().split()]
	print(min(int((a + b + c) / 3), min(a, b)))


q = int(input())
for query in range(q):
	(c, m, x) = map(int, input().split(' '))
	res = 0
	maxi = min(c, m, (c + m + x) // 3)
	c -= maxi
	m -= maxi
	if maxi == 0:
		res = 0
	else:
		res = min(maxi, c + m + x)
	print(res)


for _ in range(int(input())):
	(c, m, nulla) = map(int, input().split())
	print(min((c + m + nulla) // 3, c, m))


import math
t = int(input())
for i in range(t):
	(c, m, x) = input().split()
	c = int(c)
	m = int(m)
	x = int(x)
	if c == 0 or m == 0:
		print(0)
		continue
	elif c < m:
		if c * 2 <= m + x:
			ans = c
			ans = int(ans)
		else:
			temp = c * 2
			temp = float(temp)
			temp = temp - (m + x)
			temp = temp / 3
			ans = c - math.ceil(temp)
	elif m <= c:
		if m * 2 <= c + x:
			ans = m
			ans = int(ans)
		else:
			temp = m * 2
			temp = float(temp)
			temp = temp - (c + x)
			temp = temp / 3
			ans = m - math.ceil(temp)
	print(ans)


for u in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(min(x, y, (x + y + z) // 3))


query = []
q = int(input())
for i in range(q):
	a = str(input())
	a = a.split(' ')
	a = [int(i) for i in a]
	query.append(a)
results = []
for i in range(q):
	c = query[i][0]
	m = query[i][1]
	x = query[i][2]
	if c + m + x < 3 or c == 0 or m == 0:
		results.append(0)
	elif c >= m:
		if (c + m + x) // 3 < m:
			results.append((c + m + x) // 3)
		else:
			results.append(m)
	elif (c + m + x) // 3 < c:
		results.append((c + m + x) // 3)
	else:
		results.append(c)
print(*results, sep='\n')


n = int(input())
B = []
for i in range(n):
	A = list(map(int, input().split()))
	if min(A) == A[0]:
		B.append(A[0])
	elif min(A) == A[1]:
		B.append(A[1])
	elif min(A) == A[2]:
		x = A[0] - A[2]
		y = A[1] - A[2]
		if x / y <= 0.5 or x / y >= 2:
			B.append(A[2] + min(x, y))
		else:
			z = abs(x - y) + (min(x, y) - abs(x - y)) * 2 // 3
			B.append(A[2] + z)
for i in range(n):
	print(B[i])


for _ in range(int(input())):
	(n, c, m) = map(int, input().split())
	count = 0
	if n == 0 or c == 0 or n + c + m < 3:
		print(0)
	else:
		a = min(n, c, m)
		n -= a
		c -= a
		m -= a
		count += a
		if n != 0 and c != 0:
			count += min(n, c, (n + c + m) // 3)
		print(count)


import sys
from collections import defaultdict
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}'.format(i) + sep)
INF = float('inf')
MOD = int(1000000000.0 + 7)
for q in range(int(input())):
	(c, m, x) = map(int, input().split())
	if x >= min(c, m):
		write(min(c, m))
	else:
		if c < m:
			(c, m) = (m, c)
		diff = c - m
		y = min(x + diff, m)
		if y == m:
			write(y)
		else:
			c -= y + diff
			m -= y
			write(y + (c + m) // 3)


t = int(input())
while t > 0:
	(c, m, x) = map(int, input().split())
	ans = 0
	d = max(c, m) - min(c, m)
	if c > m:
		c -= d
	else:
		m -= d
	x += d
	ans = min(c, m, x)
	c -= ans
	m -= ans
	x -= ans
	ans += (m + c) // 3
	print(ans)
	t -= 1


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	print(min(c, m, (c + m + x) // 3))


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	ans = min(c, m, x)
	c -= ans
	m -= ans
	ans += (c + m) // 3
	print(ans)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	s = c + m + x
	m1 = min(c, m, s // 3)
	print(m1)


for _ in range(int(input())):
	arr = list(map(int, input().split()))
	a = sum(arr) // 3
	b = min(arr[0], arr[1])
	print(min(a, b))


t = int(input())
answer = []
for _ in range(t):
	(c, m, x) = map(int, input().split())
	l = 0
	r = min(c, m)
	ans = 0
	while l <= r:
		med = (l + r) // 2
		if c - med + m - med + x >= med:
			l = med + 1
			ans = med
		else:
			r = med - 1
	answer.append(ans)
for i in answer:
	print(i)


q = int(input())
for _ in range(q):
	students = list(map(int, input().split()))
	ans = min(students[0], students[1], sum(students) // 3)
	print(ans)


q = int(input())
for i in range(q):
	(n, m, x) = map(int, input().split())
	print(min(n, m, (n + m + x) // 3))


def solve(c, m, x):
	if c == 0 or m == 0:
		return 0
	if x >= min(c, m):
		return min(c, m)
	c -= x
	m -= x
	(c, m) = (max(c, m), min(c, m))
	p = c - m
	return x + m if p >= m else x + (c + m) // 3
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	print(solve(c, m, x))


n_queries = int(input())
for i in range(n_queries):
	[m, n, x] = list(map(int, input().split()))
	team = min(m, n, x)
	m = m - team
	n = n - team
	x = x - team
	if m == 0 or n == 0:
		print(team)
	else:
		print(team + min(m, n, (m + n) // 3))


t = int(input())
while t:
	teams = list(map(int, input().split()))
	minimum = min(teams)
	if minimum == teams[0] or minimum == teams[1]:
		print(minimum)
		t -= 1
		continue
	ans = minimum
	teams[0] -= minimum
	teams[1] -= minimum
	teams[2] -= minimum
	ans += min(teams[0], teams[1], int((teams[0] + teams[1]) / 3))
	print(ans)
	t -= 1


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(min(a, b, (a + b + c) // 3))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c + m + x < 3:
		print(0)
	elif c == 0 or m == 0:
		print(0)
	else:
		v = min(c, m)
		z = m + x + c
		print(min(v, z // 3))


q = int(input())
info = [list(map(int, input().split())) for i in range(q)]
for i in range(q):
	(c, m, x) = info[i]
	if c == min(c, m, x):
		print(c)
		continue
	if m == min(c, m, x):
		print(m)
		continue
	ans = x
	c -= x
	m -= x
	if 2 * c < m:
		print(ans + c)
		continue
	if c > 2 * m:
		print(ans + m)
		continue
	print(ans + (m + c) // 3)


Q = int(input())
for q in range(Q):
	(c, m, x) = map(int, input().split())
	b = min([c, m, x])
	c -= b
	m -= b
	x -= b
	if c > m * 2:
		b += m
	elif m > c * 2:
		b += c
	else:
		b += (m + c) // 3
	print(b)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	ans = 0
	d = min(c, m, x)
	c -= d
	m -= d
	x -= d
	ans += d
	if m > 0 and c > 0:
		if m > c:
			(m, c) = (c, m)
		t = min(c - m, m)
		ans += t
		c -= 2 * t
		m -= t
		if m > 0:
			ans += (m + c) // 3
	print(ans)


def main():
	q = int(input())
	for i in range(q):
		(c, m, x) = map(int, input().split())
		p = min(c, m)
		c -= p
		m -= p
		a = c + m + x
		ans = min(p, a)
		p -= ans
		ans += 2 * p // 3
		print(ans)
main()


__author__ = 'Esfandiar'
from math import ceil
for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	m1 = min(c, m)
	m2 = max(c, m)
	res = m1
	m2 -= m1
	m2 += x
	if m2 >= res:
		print(res)
	else:
		ans = m2
		yy = res - m2
		print(yy * 2 // 3 + ans)


n = int(input())
for i in range(n):
	s = list(map(int, input().split()))
	ab = min(s[0], s[1])
	lab = abs(s[0] - s[1])
	c = s[2] + lab
	res1 = min(ab, c)
	if res1 == c:
		lab2 = ab - res1
		res1 += int(lab2 * 2) / 3
	print(int(res1))


import atexit
import io
import sys
from math import ceil
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	for _ in range(int(input())):
		(c, m, x) = map(int, input().split())
		print(min(min(c, m), (c + m + x) // 3))
main()


q = int(input())
res = []
for i in range(q):
	(c, m, x) = [int(i) for i in input().split()]
	base = min(c, min(m, x))
	if base < x:
		res.append(base)
	else:
		groupe = base
		c -= base
		m -= base
		maxi = (c + m) // 3
		final = min(maxi, min(c, m))
		groupe += final
		res.append(groupe)
for nb in res:
	print(nb)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	d = max(m, c) - min(m, c)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	ans = min(c, m, x)
	x -= ans
	c -= ans
	m -= ans
	ans += (m + c) // 3
	print(ans)


t = int(input())
for i in range(t):
	(c, m, x) = list(map(int, input().split()))
	if c + m + x < 3:
		print(0)
		continue
	if min(c, m, x) == c or min(c, m, x) == m:
		print(min(c, m))
	else:
		k1 = min(c, m) - x
		k2 = max(c, m) - x
		if k2 >= 2 * k1:
			print(k1 + x)
		else:
			print(k2 - k1 + x + round(2 * (2 * k1 - k2) // 3))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	dif = max(a, b) - min(a, b)
	c += dif
	if a > b:
		a -= dif
	else:
		b -= dif
	z = min(a, b, c)
	a -= z
	b -= z
	print(z + (a + b) // 3)


q = int(input())
for qi in range(q):
	(c, m, x) = (int(i) for i in input().split(' '))
	if x >= min(c, m):
		print(min(c, m))
	else:
		now = x
		c -= x
		m -= x
		if c > m:
			now += min(c - m, m)
			m -= min(c - m, m)
			now += (m << 1) // 3
		elif c < m:
			now += min(m - c, c)
			c -= min(m - c, c)
			now += (c << 1) // 3
		else:
			now += (c << 1) // 3
		print(now)


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]

def good_enough(c, m, x, command) -> bool:
	_c = c - command
	_m = m - command
	if _c < 0 or _m < 0:
		return False
	_x = x - command
	if _x >= 0:
		return True
	if _c >= 0 and m >= 0:
		return True
	return False

def find_most(c, m, x) -> int:
	bad = -1
	good = min(c, m) + 1
	while good - bad > 1:
		command = (good + bad) // 2
		if c + m + x - 2 * command >= command:
			bad = command
		else:
			good = command
	return bad
(T,) = read_ints()
for t in range(T):
	(c, m, x) = read_ints()
	print(find_most(c, m, x))


t = int(input())
for _ in range(t):
	(c, m, x) = list(map(int, input().split()))
	if c == 0 or m == 0:
		print(0)
		continue
	ans = 0
	cnt = min(c, m, x)
	ans += cnt
	c -= cnt
	m -= cnt
	x -= cnt
	if m == c:
		ans += (m + c) // 3
	elif m and c:
		temp = min(min(m, c), max(m, c) - min(m, c))
		ans += min(m, c, temp + (m + c - 3 * temp) // 3)
	print(ans)


IL = lambda : list(map(int, input().split()))
for i in range(int(input())):
	(c, m, x) = IL()
	print(min(c, m, (c + m + x) // 3))


from sys import stdin
import math
t = int(stdin.readline())
while t:
	(c, m, x) = map(int, stdin.readline().split())
	if c > m:
		d = c - m
		c = m
	elif m > c:
		d = m - c
		m = c
	else:
		d = 0
	x += d
	k = min(c, m, x)
	c -= k
	m -= k
	x -= k
	k += (c + m) // 3
	print(k)
	t -= 1


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	ans = min(c, m)
	x += c + m - 2 * ans
	if ans > x:
		left = ans - x
		ans = x + 2 * left // 3
	print(ans)


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	if min(c, m) <= x:
		print(min(c, m))
	else:
		ans = x
		c -= ans
		m -= ans
		(c, m) = (max(c, m), min(c, m))
		diff = c - m
		if c >= m * 2:
			print(m + ans)
		else:
			c = c - diff * 2
			m = m - diff
			ans = ans + diff
			ans += (c + m) // 3
			print(ans)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(c, m, x):
	b = min(c, m)
	return min(b, (c + m + x) // 3)

def main():
	Q = read_int()
	for _ in range(Q):
		(c, m, x) = read_int_n()
		print(slv(c, m, x))
main()


for __ in range(int(input())):
	(c, m, x) = list(map(int, input().split()))
	print(min(min(c, m), (c + m + x) // 3))


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	x = min(a, b)
	y = min(x, (a + b + c) / 3)
	print(int(y))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	k = min(m, c)
	print(min(k, max(m + c + x - 2 * k, (m + c + x) // 3)))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
	else:
		d = 0
		if x > 0:
			r = min(c, m, x)
			x -= r
			c -= r
			m -= r
			d += r
		if c > 0 and m > 0:
			if max(c, m) - min(c, m) * 2 < 0:
				d += (c + m) // 3
			else:
				d += min(c, m)
		print(d)


t = int(input())
for i in range(t):
	(c, m, x) = map(int, input().split())
	ans = min(c, m, x)
	(c, m, x) = (c - ans, m - ans, x - ans)
	if c == 0 or m == 0:
		print(ans)
	else:
		s = (c + x + m) // 3
		ans = ans + s + min(c - s, m - s, 0)
		print(ans)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	mn = min(c, m)
	d = abs(c - m)
	if x >= mn:
		ans = mn
	else:
		x = x + d
		if x >= mn:
			ans = mn
		else:
			fix = x
			extra = 2 * (mn - x)
			ans = fix + extra // 3
	print(ans)


from sys import stdin
from collections import defaultdict
input = stdin.readline
T = int(input())
for t in range(1, T + 1):
	(c, m, x) = map(int, input().split())
	print(min(c, min(m, (c + m + x) // 3)))


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	l = 0
	r = min(c, m)
	ans = 0
	while l <= r:
		mid = (l + r) // 2
		if c + m + x - 2 * mid >= mid:
			l = mid + 1
			ans = mid
		else:
			r = mid - 1
	print(ans)


t = int(input())
for test_case in range(t):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
		continue
	if c <= m and c <= x:
		print(c)
	elif m <= c and m <= x:
		print(m)
	else:
		ans = x
		c -= x
		m -= x
		if c > 0 and m > 0:
			ans += min(min(m, c), (m + c) // 3)
		print(ans)


t = int(input())
while t > 0:
	t -= 1
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print('0')
	elif c == m:
		if x >= m:
			print(c)
		else:
			print((c + m + x) // 3)
	else:
		y = min(c, m)
		if max(c, m) - y + x >= y:
			print(y)
		else:
			print((c + m + x) // 3)


def solve():
	(a, b, c) = map(int, input().split())
	k = min(a, b)
	a -= k
	b -= k
	c += a + b
	if k <= c:
		print(k)
	else:
		f = (k - c) // 3
		print(max(min(k - f, c + 2 * f), min(k - (f + 1), c + 2 * (f + 1))))
for i in range(int(input())):
	solve()


Q = int(input())
for q in range(Q):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
		continue
	if min(c, m, x) == x:
		c -= x
		m -= x
		b = max(c, m)
		s = min(c, m)
		if (s + b) // 3 > s:
			print(s + x)
		else:
			print((s + b) // 3 + x)
		continue
	if min(c, m, x) == c or min(c, m, x) == m:
		print(min(c, m, x))
		continue


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	print(min(c, m, (c + m + x) // 3))


q = int(input())
l = []
for i in range(q):
	arr = input().split(' ')
	l.append(arr)
for i in range(q):
	c = int(l[i][0])
	m = int(l[i][1])
	x = int(l[i][2])
	sum = c + m + x
	count = 0
	if sum >= 3 and c != 0 and (m != 0):
		if c <= m:
			k = m + x
			if c <= k // 2:
				count = c
			else:
				count = sum // 3
		else:
			k = c + x
			if m <= k // 2:
				count = m
			else:
				count = sum // 3
	print(count)


import math
t = int(input())

def fn():
	(c, m, n) = map(int, input().split())
	maxi = (c + m + n) // 3
	if max(c, m) > maxi:
		if min(c, m) >= maxi:
			print(maxi)
		else:
			print(min(c, m))
	else:
		print(min(c, m))
while t:
	t -= 1
	fn()


n = int(input())
for _ in range(n):
	(c, m, x) = map(int, input().split())
	ans = 0
	if c == 0 or m == 0:
		pass
	elif c <= 1 or m <= 1:
		mi = min(c, m, x)
		ans += mi
		c -= mi
		m -= mi
		x -= mi
	if c != 0 and m != 0:
		while x != 0 and c > 0 and (m > 0):
			mi = min(c, m, x)
			ans += mi
			c -= mi
			m -= mi
			x -= mi
		flag = True
		if c > m:
			mi = c - m
			if mi > m:
				ans += m
				flag = False
			else:
				m -= mi
				c -= 2 * mi
				ans += mi
		else:
			mi = m - c
			if mi > c:
				ans += c
				flag = False
			else:
				c -= mi
				m -= 2 * mi
				ans += mi
		if flag:
			ans += (c + m) // 3
	print(ans)


from math import ceil
for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	t = min(c, m)
	x = x + c - t + m - t
	if t > x:
		t = t - ceil((t - x) / 3)
	print(t)


n = int(input())
for _ in range(n):
	(c, m, x) = list(map(int, input().split()))
	z = min(c, m, x)
	if z == m or z == c:
		print(min(c, m, x))
	elif z == x:
		a = x
		c = c - x
		m = m - x
		t = (c + m) // 3
		if t < min(c, m):
			a += t
		else:
			a += min(c, m)
		print(a)


import sys, math

def main():

	def input():
		return sys.stdin.readline()[:-1]
	q = int(input())
	for _ in range(q):
		(c, m, x) = map(int, input().split())
		t = min(c, m)
		r = c + m + x - 2 * t
		if t <= r:
			print(t)
		else:
			k = math.ceil((t - r) / 3)
			print(t - k)
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(inf, mat, zero) = map(int, input().split())
	wynik = min(zero, mat, inf)
	zero -= wynik
	mat -= wynik
	inf -= wynik
	p = min(mat, inf, (mat + inf) // 3)
	print(wynik + p)


q = int(input())

def count(c, m, x):
	min = c if c < m else m
	qty = (c + m + x) // 3
	if min < qty:
		return min
	else:
		return qty
res = ''
for i in range(q):
	(c, m, x) = map(int, input().split())
	res += str(count(c, m, x)) + '\n'
print(res.strip())


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


from sys import stdin
for i in range(int(stdin.readline())):
	(c, m, x) = list(map(int, stdin.readline().split()))

	def ok(nteam):
		return c >= nteam and m >= nteam and (x + c + m >= 3 * nteam)
	l = 0
	r = max(c, m, x) + 1
	while r - l > 1:
		mid = (r + l) // 2
		if ok(mid):
			l = mid
		else:
			r = mid
	print(l)


n = int(input())
i = 0
numbers = list()
while i < n:
	numbers.append(input().split())
	i += 1
for i in numbers:
	print(int(min(int((int(i[0]) + int(i[1]) + int(i[2])) / 3), int(i[0]), int(i[1]))))


mod = 10 ** 9 + 7
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq
from random import randint as rn

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	t = inin()
	for _ in range(t):
		(n, m, k) = map(int, input().split())
		x = min(n, m)
		print(min(x, (m + n + k) // 3))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
main()


def bin_search(a, b):
	(l, r) = (-1, a)
	while r - l > 1:
		mid = (r + l) // 2
		if a - mid > b + 2 * mid:
			l = mid
		else:
			r = mid
	return r
t = int(input())
for q in range(t):
	(c, m, x) = map(int, input().split())
	f = min(c, m)
	c -= f
	m -= f
	x += c + m
	d = bin_search(f, x)
	print(f - d)


import math
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c == m and m == x:
		print(c)
		continue
	if x < c and x < m:
		mv = abs(m - c)
		if m >= c:
			m = m - mv
		else:
			c = c - mv
		x = x + mv
		if x < c:
			w = c + m + x
			print(w // 3)
		else:
			print(min(c, m, x))
			continue
	else:
		print(min(c, m, x))


n = int(input().split()[0])
a = [[int(j) for j in input().split()] for i in range(n)]
for i in range(n):
	print(min(min(a[i][0], a[i][1]), int((a[i][0] + a[i][1] + a[i][2]) / 3)), end='\n')


from os import path
import sys
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, deque
from itertools import permutations
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(I()):
	(c, m, x) = tup()
	d = max(c, m) - min(c, m)
	if c > m:
		c -= d
	else:
		m -= d
	x += d
	ans = min(c, m, x)
	(x, m, c) = (x - ans, m - ans, c - ans)
	print(ans + (c + m) // 3)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	z = min(c, m)
	ans1 = 0
	ans2 = 0
	c1 = 3 * (z // 3)
	if x >= c1:
		m -= c1
		c -= c1
		ans1 += c1
		x = x - c1
		c1 = 0
	else:
		c -= x
		m -= x
		ans1 += x
		c1 = c1 - x
		x = 0
	if x == 0:
		ans1 += min((c + m) // 3, min(c, m))
	elif x == 1:
		if min(m, c) == 2:
			if max(m, c) == 2:
				ans1 += 1
			else:
				ans1 += 2
		elif min(m, c) == 1:
			ans1 += 1
	elif x > 1:
		if min(m, c) == 2:
			ans1 += 2
		elif min(m, c) == 1:
			ans1 += 1
	print(ans1)


t = int(input())
while t != 0:
	t -= 1
	l = [int(i) for i in input().split()]
	if sum(l) // 3 < min(l[0], l[1]):
		print(sum(l) // 3)
	else:
		print(min(l[0], l[1]))


q = int(input())
for i in range(q):
	s = list(map(int, input().split(' ')))
	c = s[0]
	m = s[1]
	x = s[2]
	y = min(c, m)
	if y <= (c + m + x) / 3:
		print(y)
	else:
		print(int((c + m + x) / 3))


from collections import *
from bisect import *
from math import *
from heapq import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(c, m, x) = map(int, input().split())
	dif = max(c, m) - min(c, m)
	if c > m:
		c -= dif
	else:
		m -= dif
	x += dif
	x1 = min(c, m, x)
	c -= x1
	m -= x1
	x -= x1
	s = x1
	s += (c + m) // 3
	print(s)


t = int(input())
for i in range(t):
	(c, m, x) = map(int, input().split())
	p = min(c, m, x)
	c -= p
	m -= p
	p1 = min(c, m, (c + m) // 3)
	print(p + p1)


n = int(input())
while n:
	n -= 1
	(a, b, c) = map(int, input().split())
	x = a + b + c
	y = x // 3
	if a >= y and b >= y:
		print(y)
	else:
		print(min(a, b))


for _ in range(int(input())):
	itens = input().split()
	code = int(itens[0])
	math = int(itens[1])
	rest = int(itens[2])
	mini = min(math, code)
	if mini == 0:
		print(0)
	else:
		all = code + math + rest
		all = all // 3
		print(min(all, mini))


number = int(input())
if number >= 1 and number <= 10 ** 4:
	state = False
	array = []
	for i in range(number):
		(c, m, x) = map(int, input().split())
		if c >= 0 and c <= 10 ** 8 and (m >= 0) and (m <= 10 ** 8) and (x >= 0) and (x <= 10 ** 8):
			state = True
			if c == 0 or m == 0 or m + c + x < 3:
				array.append(0)
			else:
				minVa = min(c, m)
				minMlu = minVa * 2
				maxVa = max(c, m) + x
				diff = minMlu - maxVa
				if minMlu <= maxVa:
					array.append(minVa)
				elif diff % 3 == 0:
					re = int(diff / 3)
					array.append(minVa - re)
				else:
					re = int(diff / 3)
					array.append(minVa - (re + 1))
		else:
			break
	if state:
		for i in array:
			print(i)


queries = int(input())
(count, res) = (0, 0)
for q in range(queries):
	(count, res) = (0, 0)
	team = list(map(int, str(input()).split(' ')))
	count = min(team[0], team[1])
	if count <= team[2]:
		res = count
	else:
		res = sum(team) / 3
		if res > count:
			res = count
	print(int(res))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	while t != 0:
		(c, m, x) = map(int, input().split())
		print(min(c, m, int((c + m + x) / 3)))
		t -= 1
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
t = R2()
for _ in range(t):
	(c, m, x) = R1()
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	res = min(c, m, x)
	res += (c + m - 2 * res) // 3
	print(res)


from sys import stdin
from math import ceil, log

def check(num):
	if num <= c and num <= m:
		if c - num + m - num >= num:
			return True
	return False
q = int(stdin.readline().strip())
for _ in range(q):
	(c, m, x) = list(map(int, stdin.readline().split()))
	mn = min(c, m, x)
	if mn == c or mn == m:
		print(mn)
	else:
		ans = x
		c -= x
		m -= x
		start = 0
		end = 10 ** 8
		while True:
			if start >= end:
				if check(start):
					pass
				else:
					start -= 1
				break
			mid = (start + end) // 2
			if check(mid):
				start = mid + 1
			else:
				end = mid - 1
		if check(start):
			ans += start
		else:
			ans += start - 1
		print(ans)


Q = int(input())
for q in range(Q):
	(c, m, x) = map(int, input().split())
	print(min(c, min(m, (c + m + x) // 3)))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split(' '))
	minimum = min(c, m, x)
	c -= minimum
	m -= minimum
	x -= minimum
	if c == 0 or m == 0:
		print(minimum)
	else:
		cmm = 0
		mcc = 0
		if c < m:
			n = min(c, m // 2)
			cmm += n
			c -= n
			m -= 2 * n
		else:
			n = min(m, c // 2)
			mcc += n
			m -= n
			c -= 2 * n
		if c + m >= 3:
			if c < m:
				n = min(c, m // 2)
				cmm += n
				c -= n
				m -= 2 * n
			else:
				n = min(m, c // 2)
				mcc += n
				m -= n
				c -= 2 * n
			if c + m == 0:
				print(mcc + cmm + minimum)
			elif c != 0:
				n = min(cmm, c // 3)
				print(mcc + cmm + n + minimum)
			else:
				n = min(mcc, m // 3)
				print(mcc + cmm + n + minimum)
		else:
			print(mcc + cmm + minimum)


n = input()
for i in range(int(n)):
	k = input()
	klis = k.split(' ')
	if int(klis[0]) > int(klis[1]):
		min = int(klis[1])
	else:
		min = int(klis[0])
	sum = int(klis[0]) + int(klis[1]) + int(klis[2])
	if sum >= 3 * min:
		print(min)
	else:
		print(sum // 3)
		klis.clear()


n1 = int(input())
for i in range(n1):
	cmx = list(map(int, input().rstrip().split()))
	c = cmx[0]
	m = cmx[1]
	x = cmx[2]
	all3diff = min(c, m, x)
	s = all3diff
	c -= all3diff
	m -= all3diff
	x -= all3diff
	if c * m == 0:
		print(s)
	elif 2 * min(m, c) >= max(m, c):
		s += (m + c) // 3
		print(s)
	else:
		s += min(m, c)
		print(s)


for i in range(int(input())):
	(n, m, q) = map(int, input().split())
	mi = min(n, m, q)
	n -= mi
	m -= mi
	q -= mi
	if n == 0 or m == 0:
		print(mi)
	else:
		print(min((n + m) // 3 + mi, n + mi, m + mi))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = min(a, b, c)
	a -= ans
	b -= ans
	c -= ans
	if a > 0 and b > 0:
		ans += min(a, b, (a + b + c) // 3)
	print(ans)


def solution(a, b, c):
	ans = 0
	min = 0
	if a <= b:
		min = a
	else:
		min = b
	if c > min:
		ans = min
		return ans
	elif c <= min:
		ans += c
		a -= c
		b -= c
		c = 0
	if a == 0 or b == 0:
		return ans
	k = (a + b) // 3
	if k <= a and k <= b:
		ans += k
		return ans
	else:
		m = 0
		if a <= b:
			m = a
		else:
			m = b
		ans += m
		return ans
n = int(input())
for i in range(n):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	print(solution(a, b, c))


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	tot = 0
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	tot = min(c, m, x)
	c -= tot
	m -= tot
	x -= tot
	tot += (c + m) // 3
	print(tot)


try:
	from string_source import string_source
	source = string_source('6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1')
except ImportError:
	source = input

def n_perfect_teams(c, m, x):
	if c < m:
		return n_perfect_teams(m, c, x)
	return min(m, (c + x + m) // 3)
for _ in range(int(source())):
	print(n_perfect_teams(*map(int, source().split(' '))))
if False:
	assert n_perfect_teams(5, 6, 1) == 4
	assert n_perfect_teams(6, 5, 1) == 4
	assert n_perfect_teams(6, 5, 0) == 3
	assert n_perfect_teams(2, 5, 0) == 2
	assert n_perfect_teams(1, 5, 0) == 1
	assert n_perfect_teams(0, 5, 0) == 0


q = int(input())
for i in range(0, q):
	(c, m, x) = input().split()
	(c, m, x, sum) = (int(c), int(m), int(x), 0)
	Max = max(c, max(m, x))
	Min = min(c, min(m, x))
	if Max == x:
		print(Min)
	else:
		(c, m, sum) = (c - x, m - x, sum + x)
		(Min, Max) = (min(c, m), max(c, m))
		if Min * 2 > Max:
			sub = Max - Min
			sum += sub + int(2 * (Min - sub) / 3)
			print(sum)
		else:
			print(sum + Min)


n = int(input())
for i in range(n):
	(c, m, x) = list(map(int, input().split()))
	wynik = 0
	wynik += min(c, m, x)
	huj = min(c, m, x)
	c -= huj
	m -= huj
	x -= huj
	if x > 0:
		print(wynik)
	else:
		if c > m:
			(c, m) = (m, c)
		wynik += min(m, c, (m + c) // 3)
		print(wynik)


import sys
input = sys.stdin.readline

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

def getVars():
	return list(map(int, input().split()))

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()

def addDictList(d, key, val):
	if key not in d:
		d[key] = []
	d[key].append(val)

def addDictInt(d, key, val):
	if key not in d:
		d[key] = 0
	d[key] = val

def addDictCount(d, key):
	if key not in d:
		d[key] = 0
	d[key] += 1

def addDictSum(d, key, val):
	if key not in d:
		d[key] = 0
	d[key] += val
t = getInt()
for _ in range(t):
	(c, m, x) = getVars()
	res = min(c, m)
	res = min(res, (c + m + x) // 3)
	print(res)


q = int(input())
while q:
	q -= 1
	(c, m, x) = map(int, input().split())
	tot = c + m + x
	maxn = min(c, m)
	tot = tot // 3
	if maxn <= tot:
		print(maxn)
	else:
		print(tot)


import sys
import bisect as b
import math
from collections import defaultdict as dd
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
for i in range(inin()):
	(c, m, x) = cin()
	print(min((c + m + x) // 3, c, m))


import math

def get_n_teams(c, m, x):
	if x >= c or x >= m:
		return min(c, m)
	x += abs(c - m)
	cm = min(c, m)
	if x >= cm:
		return cm
	step = int(math.ceil((cm - x) / 3))
	return min(x + step * 2, cm - step)

def main():
	n_queries = int(input())
	for _ in range(n_queries):
		(c, m, x) = list(map(int, input().split()))
		print(get_n_teams(c, m, x))
main()


import sys, math
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	(c, m, x) = map(int, I().split())
	team = 0
	if c != 0 and m != 0 and (x != 0):
		y = min(c, m, x)
		team += y
		c -= y
		m -= y
		x -= y
	if c > 0 and m > 0:
		team += min(min(c, m), (c + m) // 3)
	ans += str(team) + '\n'
print(ans)


def poss(c, m, x, ts):
	if min(c, m) < ts:
		return False
	c -= ts
	m -= ts
	if ts <= c + m + x:
		return True
	return False
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	l = 0
	r = 10 ** 9
	ans = 0
	while l <= r:
		ts = (l + r) // 2
		if poss(c, m, x, ts):
			ans = ts
			l = ts + 1
		else:
			r = ts - 1
	print(ans)


q = int(input())
for _ in range(q):
	(c, m, x) = list(map(lambda u: int(u), input().split(' ')))
	M = min(m, c)
	X = c + m + x - 2 * M
	if X < M:
		print((2 * M + X) // 3)
	else:
		print(M)


Q = int(input())

def solve():
	[c, m, x] = list(map(int, input().split()))

	def canMakeK(k):
		if c < k or m < k:
			return False
		return c - k + (m - k) + x >= k
	ans = 0
	jump = max(c, m, x)
	while jump > 0:
		while canMakeK(ans + jump):
			ans += jump
		jump //= 2
	return ans
for _ in range(Q):
	print(solve())


q = int(input())
for _ in range(q):
	(c, m, x) = list(map(int, input().strip().split()))
	if c > m:
		x += c - m
		c -= c - m
	elif m > c:
		x += m - c
		m -= m - c
	if m - x > 1:
		print((m * 2 + x) // 3)
	else:
		print(min([c, m, x]))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	ans = t1 = min(c, m, x)
	c -= t1
	m -= t1
	x -= t1
	if c > m:
		(c, m) = (m, c)
	d = m - c
	t2 = min(d, m, c)
	ans += t2
	c -= t2
	m -= 2 * t2
	t2 = min(c, m) // 3
	ans += t2 * 2
	c -= t2 * 3
	m -= t2 * 3
	if c > m:
		(c, m) = (m, c)
	if c and m >= 2:
		ans += 1
		c -= 1
		m -= 2
	if c > m:
		(c, m) = (m, c)
	if c and m >= 2:
		ans += 1
		c -= 1
		m -= 2
	print(ans)


q = int(input(''))
totals = []
for i in range(q):
	cmx = input('').split(' ')
	c = int(cmx[0])
	m = int(cmx[1])
	x = int(cmx[2])
	if x >= m or x >= c:
		total = min(m, x, c)
	else:
		total = x
		m -= x
		c -= x
		if m > c:
			half = min(c, m - c)
			c -= half
			m -= 2 * half
		else:
			half = min(m, c - m)
			c -= 2 * half
			m -= half
		total += half
		opt = min(m, c)
		third = opt // 3
		total += 2 * third
		c -= 3 * third
		m -= 3 * third
		if c > 1 and m > 1 and (c + m > 2):
			total += 1
	totals.append(total)
for total in totals:
	print(total)


for _ in ' ' * int(input()):
	(a, b, c) = map(int, input().split())
	if a == 0 or b == 0:
		print(0)
	elif c == 0:
		print(min(a, b, (a + b) // 3))
	elif min(a, b) <= c:
		print(min(a, b))
	else:
		a -= c
		b -= c
		print(c + min(a, b, (a + b) // 3))


test = int(input())
for _ in range(test):
	(coder, maths, other) = list(map(int, input().split()))
	print(min(coder, maths, (coder + maths + other) // 3))


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

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

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

def Sn():
	return sys.stdin.readline().strip()

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gte(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def check(a, b, c):
	if a > b:
		(a, b) = (b, a)
	c += b - a
	b = a
	if a == b and c < a:
		a -= c
		b -= c
		ans = c
		return ans + (a + b) // 3
	return 0

def main():
	try:
		(a, b, c) = In()
		if a == b and c < a:
			a -= c
			b -= c
			ans = c
			print(ans + (a + b) // 3)
			return
		ans = min(min(a, b), c + a - min(a, b) + b - min(a, b))
		ans = max(check(a, b, c), ans)
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for i in range(int(input())):
	(c, m, s) = map(int, input().split())
	(q, w) = (min(c, m), max(c, m))
	print(q if q <= s else min(q, (q - s * 2 + w) // 3 + s))


import math
n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	ans = min(min(c, m), math.floor((c + m + x) // 3))
	print(ans)


Q = int(input())
for _ in range(Q):
	(C, M, X) = map(int, input().split())
	print(min(C, M, (C + M + X) // 3))


from math import *
q = int(input())
sta = []
sts = []
for x in range(0, q):
	sta.append(input().split(' '))
	if int(sta[x][0]) == 0 or int(sta[x][1]) == 0:
		sts.append(0)
	elif int(sta[x][0]) < int(sta[x][1]) and int(sta[x][0]) <= int(sta[x][2]):
		sts.append(sta[x][0])
	elif int(sta[x][1]) < int(sta[x][0]) and int(sta[x][1]) <= int(sta[x][2]):
		sts.append(sta[x][1])
	elif int(sta[x][2]) < int(sta[x][0]) and int(sta[x][2]) < int(sta[x][1]):
		c = 0
		d = 0
		sta[x][1] = str(int(sta[x][1]) - int(sta[x][2]) - c)
		sta[x][0] = str(int(sta[x][0]) - int(sta[x][2]) - c)
		if int(sta[x][0]) >= 2 * int(sta[x][1]):
			c = abs(int(sta[x][0]) - int(sta[x][1]))
			sts.append(str(int(sta[x][2]) + int(sta[x][1])))
		elif int(sta[x][1]) >= 2 * int(sta[x][0]):
			c = abs(int(sta[x][0]) - int(sta[x][1]))
			sts.append(str(int(sta[x][2]) + int(sta[x][0])))
		else:
			c = abs(int(sta[x][0]) - int(sta[x][1]))
			if int(sta[x][1]) > int(sta[x][0]):
				sta[x][1] = str(int(sta[x][1]) - 2 * c)
				sta[x][0] = str(int(sta[x][0]) - c)
			elif int(sta[x][0]) > int(sta[x][1]):
				sta[x][1] = str(int(sta[x][1]) - c)
				sta[x][0] = str(int(sta[x][0]) - 2 * c)
			d = floor((int(sta[x][0]) + int(sta[x][1])) / 3)
			sts.append(str(int(sta[x][2]) + c + d))
	elif int(sta[x][0]) == int(sta[x][1]):
		sts.append(sta[x][0])
for x in range(0, q):
	print(sts[x])


from bisect import *
from math import *
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	maxx = min(c, m)
	print(min(maxx, (c + m + x) // 3))


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
	elif min(c, x, m) in (c, m):
		print(min(c, x, m))
	else:
		w = min(c, x, m)
		if c - x > 2 * (m - x):
			c = 2 * (m - x) + x
		if m - x > 2 * (c - x):
			m = 2 * (c - x) + x
		print(x + (c - x + m - x) // 3)


tc = int(input())
for _ in range(tc):
	(c, m, x) = list(map(int, input().split()))
	total_teams = (c + m + x) // 3
	miTeams = min(c, m)
	if miTeams > total_teams:
		print(total_teams)
	else:
		print(miTeams)


n = int(input())

def calculate(a, b, c):
	a = int(a)
	b = int(b)
	c = int(c)
	m = max(a, b)
	k = min(a, b)
	reserve = m - k
	j = k - (reserve + c)
	if 2 * k >= j > 0:
		return k - (j + 2) // 3
	elif j > 2 * k:
		return 0
	else:
		return k
for i in range(1, n + 1):
	group = input().split(' ')
	print(calculate(group[0], group[1], group[2]))


t = int(input())
for case in range(t):
	(m, c, x) = map(int, input().split())
	all = m + c + x
	maxteam = all // 3
	mc = min(m, c)
	print(min(mc, maxteam))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	output = 0
	if x == min(c, m, x):
		if c < m:
			(c, m) = (m, c)
		if c + x >= 2 * m:
			output = m
		else:
			sum = c + m
			groups = int((c + m) / 3)
			sum -= groups * 3
			groups += int((sum + x) / 3)
			output = groups
	else:
		output = min(c, m)
	print(output)


q = int(input())
for t in range(q):
	(c, m, x) = map(int, input().split())
	ans = 0
	x += abs(c - m)
	c = min(c, m)
	m = c
	ans += min(c, m, x)
	c -= ans
	m -= ans
	x -= ans
	if c * m == 0:
		print(ans)
	else:
		ans += (c + m) // 3
		print(ans)


def find(x):
	global mini, c
	if mini - x <= c + x * 2:
		return 1
	return -1
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	mini = min(a, b)
	a -= mini
	b -= mini
	c += a + b
	lb = 0
	ub = mini
	while lb <= ub:
		mid = (lb + ub) // 2
		x1 = find(mid)
		if x1 >= 1:
			ans = mid
			ub = mid - 1
		else:
			lb = mid + 1
	print(mini - ans)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	total = c + m + x
	most = min(c, m)
	print(most if total >= 3 * most else total // 3)


members_in_team = 3

def perfect_teams(coders, mathematicians, specializationless):
	total = coders + mathematicians + specializationless
	if total < members_in_team:
		return 0
	minimum_coders_and_mathematicians = min(coders, mathematicians)
	possible_teams = total // members_in_team
	return min(minimum_coders_and_mathematicians, possible_teams)
queries = int(input())
responses = []
for _ in range(queries):
	query = input().split()
	(coders, mathematicians, specializationless) = (int(x) for x in query)
	response = perfect_teams(coders, mathematicians, specializationless)
	responses.append(response)
for i in responses:
	print(i)


q = int(input())
for i in range(q):
	(c, m, x) = list(map(int, input().split()))
	s = c + m + x
	if s < 3:
		print(0)
	elif c == 0 or m == 0:
		print(0)
	else:
		cm = min(c, m)
		left = s - 2 * cm
		if left < cm:
			cmleft = cm - left
			cm = left + 2 * cmleft // 3
		print(cm)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	Q = int(input())
	for _ in [0] * Q:
		(c, m, x) = map(int, input().split())
		ans = 0
		while 1:
			if not c or not m:
				break
			min_ = min(c, m)
			x += c - min_ + (m - min_)
			(c, m) = (min_, min_)
			if not x:
				ans += (c + m) // 3
				break
			min_ = min(c, m, x)
			ans += min_
			(c, m, x) = (c - min_, m - min_, x - min_)
		print(ans)
main()


for i in range(int(input())):
	sol = 0
	s = list(map(int, input().split()))
	if sum(s) >= 3:
		sol = min(min(s[0], s[1]) * 3, sum(s)) // 3
	print(sol)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	teams = 0
	if c == 0 or m == 0:
		print(0)
	else:
		if c > 0 and m > 0 and (x > 0):
			menor = min(c, m, x)
			teams += menor
			c -= menor
			m -= menor
			x -= menor
		if c == 0 or m == 0:
			print(teams)
		else:
			num = (c + m) // 3
			if num > c:
				teams += c
			elif num > m:
				teams += m
			else:
				teams += num
			print(teams)


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().rstrip().split(' '))
	t = 0
	if x < min(c, m):
		t = x
		c = c - x
		m = m - x
		if m == c or max(m, c) < 2 * min(m, c):
			t += (m + c) // 3
		else:
			t += min(m, c)
	else:
		mi = min(c, m)
		t = min(mi, (max(c, m) + x) // 2)
	print(t)


import math

def sum(c, m, x):
	sum = c + m + x
	return sum
ans = []
q = int(input())
for i in range(q):
	(c, m, x) = list(map(int, input().split()))
	if sum(c, m, x) < 3:
		ans.append(0)
	elif sum(c, m, x) // 3 < min(c, m):
		ans.append(sum(c, m, x) // 3)
	else:
		ans.append(min(c, m))
for i in ans:
	print(i)


def main():
	q = int(input())
	for i in range(q):
		(c, m, x) = (int(n) for n in input().split(' '))
		(l, r) = (int(-1), int(10 ** 8 + 7))
		while l + 1 < r:
			mid = (l + r) // 2
			if (mid > c or mid > m) or c + m + x - 2 * mid < mid:
				r = mid
			else:
				l = mid
		print(l)
main()


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
	else:
		d = abs(c - m)
		x += d
		if c > m:
			c -= d
		else:
			m -= d
		ans = min(c, m, x)
		c -= ans
		m -= ans
		x -= ans
		ans = ans + (c + m) // 3
		print(ans)


q = int(input())
for _ in range(q):
	i = input().split()
	coder = int(i[0])
	mathematician = int(i[1])
	neither = int(i[2])
	perfeitos = min(min(coder, mathematician), (coder + mathematician + neither) // 3)
	print(perfeitos)


q = int(input())
while q > 0:
	(c, m, k) = input().split()
	c = int(c)
	m = int(m)
	k = int(k)
	teams = (c + m + k) // 3
	if c < teams:
		if m < c:
			teams = m
		else:
			teams = c
	elif m < teams:
		if c < m:
			teams = c
		else:
			teams = m
	print(teams)
	q -= 1


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c != m:
		x += max(c, m) - min(c, m)
		(c, m) = (min(c, m), min(c, m))
		if x >= c:
			print(c)
		else:
			print((x + c + m) // 3)
	elif x >= c:
		print(c)
	else:
		print((x + c + m) // 3)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	maxC = min(c, m)
	r = c + m - 2 * maxC + x
	print(min(maxC, (maxC * 2 + r) // 3))


ans = []
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	n = min(min(c, m), x)
	a = n + (c - n + m - n + x - n) // 3
	if min(c, m) < a:
		ans.append(min(c, m))
	else:
		ans.append(a)
print('\n'.join([str(_) for _ in ans]))


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	min1 = min(a, b)
	ans1 = 0
	if min1 > c:
		a = a - c
		b = b - c
		ans1 += c
		if a > 0 and b > 0:
			x = (a + b) // 3
			min2 = min(a, b)
			if x > min2:
				ans1 += min2
			else:
				ans1 += x
	else:
		ans1 += min1
	print(ans1)


n = int(input())
for i in range(n):
	a = list(map(int, input().split()))
	if min(a) != a[2]:
		print(min(a[0], a[1]))
	else:
		q = 0
		q = a[2]
		a[0] = a[0] - a[2]
		a[1] = a[1] - a[2]
		a.remove(a[2])
		if a[0] >= sum(a) // 3 and a[1] >= sum(a) // 3:
			q = q + sum(a) // 3
			print(q)
		else:
			q = q + min(a[0], a[1])
			print(q)


q = int(input())
for i in range(q):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	if max(a, b) - min(a, b) + c >= min(a, b):
		print(min(a, b))
	else:
		print((a + b + c) // 3)


def main():
	t = int(input())
	for i in range(t):
		(c, m, x) = input().split()
		c = int(c)
		m = int(m)
		x = int(x)
		s = c + m + x
		mi = min(c, m)
		print(min(int(s / 3), mi))
main()


q = int(input())
for q in range(q):
	l = list(map(int, input().split()))
	print(min(min(l[0], l[1]), sum(l) // 3))


t = int(input())
while t:
	t -= 1
	(c, m, x) = map(int, input().split())
	res = min(c, m, x)
	if res == c or res == m:
		print(res)
	else:
		c = c - x
		m = m - x
		ans = x
		mn = min(c, m)
		mx = max(c, m)
		if mx >= 2 * mn:
			print(ans + mn)
		else:
			dif = mx - mn
			ans += dif
			mx -= 2 * dif
			mn -= dif
			print(ans + 2 * mn // 3)


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	ma = max(c, m)
	mi = min(c, m)
	x += ma - mi
	ma = mi
	if min(ma, x) == ma:
		ans = ma
	else:
		ans = x
		ma -= x
		mi -= x
		ans += (ma + mi) // 3
	print(ans)


from math import ceil
n = int(input())
for i in range(n):
	(m, c, x) = map(int, input().split())
	t = min(m, c, x)
	m = m - t
	c = c - t
	x = x - t
	ans = t
	r1 = max(m, c)
	r2 = min(m, c)
	if r1 >= 2 * r2:
		print(ans + r2)
		continue
	t1 = ceil((2 * r2 - r1) / 3)
	r2 = r2 - 2 * t1
	ans = ans + t1 + r2
	print(ans)


q = int(input())
while q > 0:
	q -= 1
	(c, m, x) = list(map(int, input().split()))
	t = min(c, m)
	x = int((c + m + x) / 3)
	ans = min(t, x)
	print(ans)


n = int(input())
for i in range(n):
	s = list(map(int, input().split(' ')))
	rez = 0
	c = s[0]
	m = s[1]
	x = s[2]
	rez = min(c, min(m, x))
	if rez == m or rez == c:
		print(rez)
	else:
		m -= rez
		c -= rez
		q = m + c
		q = q // 3
		if m < q or c < q:
			print(rez + min(c, m))
		else:
			print(rez + q)


from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
import math

def sp():
	return map(int, input().split())

def fun(x):
	return sum((int(i) for i in str(x)))

def find(n):
	if n == 3:
		return 3
	while 1:
		flag = 0
		for i in range(2, int(sqrt(n)) + 1):
			if n % i == 0:
				n += 1
				break
			if i == int(sqrt(n)):
				flag = 1
				break
		if flag:
			break
	return n
t = int(input())
for _ in range(t):
	(c, m, x) = sp()
	if x >= max(m, c):
		print(min(m, c))
	else:
		ans = min(m, c, x)
		m -= ans
		c -= ans
		x -= ans
		d = 0
		if c > 0 and m > 0:
			d = (m + c) // 3
		ans += min(d, m, c)
		print(ans)


import math

def maxteams(arr):
	return min(arr[0], arr[1], (arr[0] + arr[1] + arr[2]) // 3)
inputlist = []
for i in range(int(input())):
	inputlist.append(list(map(int, input().split())))
for j in inputlist:
	print(maxteams(j))


import math
q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	t = max(c, m) - min(c, m)
	x += t
	if c > m:
		c -= t
	else:
		m -= t
	ans = min(c, m, x)
	c -= ans
	m -= ans
	x -= ans
	ans += (c + m) // 3
	print(ans)


q = int(input())
for i in range(q):
	(a, b, c) = map(int, input().split())
	print(min((a + b + c) // 3, min(a, b)))


from sys import stdin, stdout

def check(lim, arr):
	if int(arr[0]) < lim or int(arr[1]) < lim:
		return False
	return max(0, int(arr[0]) - lim) + max(0, int(arr[1]) - lim) + int(arr[2]) >= lim
q = int(stdin.readline())
while q > 0:
	q = q - 1
	arr = stdin.readline().split(' ')
	res = -1
	step = 1 << 30
	while step > 0:
		if check(int(res + step), arr) == True:
			res = int(res) + int(step)
		step = int(step) / 2
	res = int(res)
	stdout.write(str(res) + '\n')


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	total = c + m + x
	mi = 0
	if c < m:
		mi = c
	else:
		mi = m
	if total > 3 * mi:
		print(mi)
	else:
		print(total // 3)


n = int(input())
for i in range(n):
	(c, m, x) = (int(i) for i in input().split())
	cnt = 0
	minn = min(c, m, x)
	cnt += minn
	c -= minn
	m -= minn
	x -= minn
	if x == 0:
		maxo = min(c, m)
		maxt = (c + m) // 3
		mx = min(maxo, maxt)
		cnt += mx
	print(cnt)


def solve():
	(c, m, x) = list(map(int, input().split()))
	u = min(c, m)
	y = c - u + m - u + x
	if y >= u:
		print(u)
		return
	print(y + (u - y) * 2 // 3)
t = int(input())
for _ in range(t):
	solve()


import sys
t = int(sys.stdin.readline())

def solve(c, m, x):
	if x >= min(c, m):
		return min(c, m)
	else:
		count = x
		c -= x
		m -= x
		count += min((c + m) // 3, c, m)
		return count
for _ in range(t):
	(c, m, x) = map(int, sys.stdin.readline().split())
	print(solve(c, m, x))


t = int(input())
for i in range(t):
	(c, m, x) = [int(x) for x in input().split()]
	counter = m + c + x
	l = 0
	r = 10 ** 9
	while r - l > 1:
		mid = (l + r) // 2
		if mid <= c and mid <= m and (mid * 3 <= counter):
			l = mid
		else:
			r = mid
	print(l)


q = int(input())
i = 0
while i < q:
	n = input()
	a = n.split(' ')
	c = int(a[0])
	m = int(a[1])
	x = int(a[2])
	if c >= (c + m + x) // 3 and m >= (c + m + x) // 3:
		print((c + m + x) // 3)
	elif c >= (c + m + x) // 3:
		print(m)
	elif m >= (c + m + x) // 3:
		print(c)
	elif m < c:
		print(m)
	else:
		print(c)
	i += 1


n = int(input())
while n:
	n = n - 1
	l = list(map(int, input().split()))
	if sum(l) // 3 < min(l[0], l[1]):
		print(sum(l) // 3)
	else:
		print(min(l[0], l[1]))


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	z = min(c, m, x)
	ans = z
	c -= z
	m -= z
	x -= z
	m = min(2 * c, m)
	c = min(2 * m, c)
	print(ans + (c + m) // 3)


t = int(input())
for _ in range(t):
	s = list(map(int, input().split()))
	a = min(s[0], s[1])
	b = max(s[0], s[1])
	num = 0
	if a >= s[2]:
		if abs(a - s[2]) <= abs(a - b):
			num += a
		else:
			t = s[2] + abs(a - b)
			num += (a - t) * 2 // 3 + t
	else:
		num += a
	print(num)


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	a = min(c, m)
	b = max(c, m)
	print(min((b + a + x) // 3, a))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	l = 0
	a = min(c, m)
	v = c - a + m - a + x
	if v >= a:
		print(a)
	else:
		if a - v >= 3:
			s = a
			a -= (a - v) // 3
			v += (s - v) // 3 * 2
		if a - v == 2:
			a -= 1
			v += 2
		print(min(a, v))


q = int(input())
for i in range(q):
	a = [int(s) for s in input().split()]
	c = a[0]
	m = a[1]
	x = a[2]
	if x >= m or x >= c:
		q = min(c, m)
	elif c < m:
		q = min(c - x + x, (m + c - 2 * x) // 3 + x)
	elif c > m:
		q = min((c + m - 2 * x) // 3 + x, m - x + x)
	elif c == m:
		q = (x + m + c) // 3
	print(q)


from math import floor
n = int(input())
for case in range(n):
	l = [int(x) for x in input().split()]
	l[2] = sum(l) // 3
	print(min(l))


for _ in range(int(input())):
	(c, m, x) = [int(i) for i in input().split()]
	if x < min(c, m):
		x = (c + m + x) // 3
	print(min(c, m, x))


T = int(input())
for testcase in range(T):
	[c, m, x] = [int(i) for i in input().split()]
	print(min(c, m, (c + m + x) // 3))


def read():
	(c, m, x) = map(int, input().split())
	return (c, m, x)

def solve(c, m, x):
	max_all = (c + m + x) // 3
	max_core = min(c, m)
	return min(max_all, max_core)
for t in range(int(input())):
	result = solve(*read())
	print(result)


from fractions import gcd
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):
		(c, m, x) = map(int, input().split())
		k = min(c, m)
		v = c + m + x - 2 * k
		if k <= v:
			print(k)
		else:
			print(k - math.ceil(abs((v - k) / 3)))
main()


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import *
(t,) = I()
while t:
	t -= 1
	(a, b, c) = I()
	ans = min(a, b, c)
	a -= ans
	b -= ans
	c -= ans
	if a == 0 or b == 0:
		print(ans)
	else:
		k = min(a, b)
		a -= k
		b -= k
		if a + b + c >= k:
			print(ans + k)
		else:
			extra = a + b + c
			m = k - extra
			if m % 3 == 0 or m % 3 == 1:
				ans += m // 3 * 2
			else:
				ans += m // 3 * 2 + 1
			print(ans + extra)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor, log
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def isPowerOfTwo(x):
	return x and (not x & x - 1)
MOD = 1000000007
PMOD = 998244353
N = 10 ** 18 + 1
LOGN = 30
alp = 'abcdefghijklmnopqrstuvwxyz'
T = 1
T = int(stdin.readline())
for _ in range(T):
	(c, m, x) = list(map(int, stdin.readline().rstrip().split()))
	if c > 0 and m > 0:
		if min(c, m) >= x:
			mn = min(c, m)
			mx = max(c, m)
			ans = x
			mn -= x
			mx -= x
			if mx > 2 * mn:
				ans += mn
			else:
				ans += (mn + mx) // 3
			print(ans)
		else:
			print(min(c, m))
	else:
		print(0)


def bs(l, h):
	while l < h:
		m = (l + h + 1) // 2
		if gf(m):
			l = m
		else:
			h = m - 1
	return l

def gf(y):
	e = m + c - 2 * y
	return x + e >= y
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	print(bs(min(c, m, x), min(c, m)))


import math
T = int(input())
for i in range(T):
	(c, m, x) = list((int(i) for i in input().split()))
	if c + m + x >= 3 and c >= 1 and (m >= 1):
		if c > m:
			doublets = m
			leftc = c - m
			if leftc + x > doublets:
				print(doublets)
			else:
				count = leftc + x
				leftdoublets = doublets - count
				people = leftdoublets * 2
				count += people // 3
				print(count)
		else:
			doublets = c
			leftm = m - c
			if leftm + x > doublets:
				print(doublets)
			else:
				count = leftm + x
				leftdoublets = doublets - count
				people = leftdoublets * 2
				count += people // 3
				print(count)
	else:
		print(0)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if m < c:
		y = m
		z = c
	elif c <= m:
		y = c
		z = m
	if z + x > 2 * y:
		print(y)
	else:
		v = (x + y + z) // 3
		print(v)


for _ in range(int(input())):
	(c, m, x) = [int(i) for i in input().split()]
	upper_bound = min(c, m)
	if upper_bound == 0:
		print(0)
	else:
		lower_bound = (c + m + x) // 3
		print(min(lower_bound, upper_bound))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	mn = min(c, m)
	need = c - mn + m - mn + x
	if mn <= need:
		print(mn)
	else:
		print(need + (mn - need) * 2 // 3)


q = int(input())
for x in range(0, q):
	(coders, mathematicians, none) = [int(i) for i in input().split(' ')]
	max_teams = min(coders, mathematicians, (coders + mathematicians + none) // 3)
	print(max_teams)


for itr in range(int(input())):
	n = input().split()
	c = int(n[0])
	m = int(n[1])
	x = int(n[2])
	count = 0
	if c < m:
		(c, m) = (m, c)
	if m <= x:
		print(m)
	elif c - x >= 2 * (m - x):
		print(x + m - x)
	else:
		print(x + (c + m - 2 * x) // 3)


q = int(input())
while q > 0:
	(c, m, x) = [int(i) for i in input().split()]
	min1 = min(c, m)
	ans = min(min1, (c + m + x) / 3)
	print(int(ans))
	q -= 1


q = int(input())
for i in range(q):
	(a, b, c) = list(map(int, input().split()))
	j = a
	k = b
	l = c
	g = min(a, b)
	a -= g
	b -= g
	c += a
	c += b
	ans = min(g, c)
	ans1 = 0
	if j > l and k > l:
		mini = (j + k + l) // 3
		if mini <= j and mini <= k:
			ans1 = mini
	print(max(ans1, ans))


def check(num):
	if c < num or m < num:
		return False
	if c - num + m - num + x >= num:
		return True
	return False
for nt in range(int(input())):
	(c, m, x) = map(int, input().split())
	low = 0
	high = 10 ** 9
	while low < high:
		mid = (low + high) // 2
		if check(mid):
			low = mid + 1
		else:
			high = mid - 1
	if check(low):
		print(low)
	else:
		print(low - 1)


Q = int(input())
data = []
for _ in range(Q):
	(c, m, x) = map(int, input().split())
	data.append([c, m, x])
for (c, m, x) in data:
	if c < m:
		if (m + x) // 2 < c:
			ans = (m + x + c) // 3
		else:
			ans = c
	elif (c + x) // 2 < m:
		ans = (m + x + c) // 3
	else:
		ans = m
	print(ans)


def solve(coder, math, nill):
	minTeams = min(coder, math)
	if minTeams < 1:
		return 0
	other = max(coder, math) + nill
	required = minTeams * 2
	if other >= required:
		return minTeams
	else:
		diff = required - other
		if diff % 3 == 0:
			return minTeams - diff // 3
		else:
			return minTeams - diff // 3 - 1
for n in range(int(input())):
	(coder, math, nill) = list(map(int, input().split()))
	print(solve(math, coder, nill))


q = int(input())
for k in range(q):
	(p, m, o) = map(int, input().split())
	print(min((p + m + o) // 3, p, m))


t = int(input())
for i in range(t):
	(c, m, x) = map(int, input().split())
	ans1 = min(c, m)
	ans2 = (c + m + x) // 3
	print(min(ans1, ans2))


querry = int(input())
for loop in range(querry):
	(c, m, n) = [int(i) for i in input().split()]
	if c == 0 or m == 0:
		print(0)
	else:
		smallest = None
		if c < m and c < n:
			smallest = 'c'
		elif m < c and m < n:
			smallest = 'm'
		elif m == c and c == n:
			print(m)
		elif m == c and m < n:
			print(m)
		else:
			smallest = 'n'
		if smallest == None:
			pass
		elif smallest == 'c':
			print(c)
		elif smallest == 'm':
			print(m)
		elif smallest == 'n':
			c -= n
			m -= n
			if c == 0 or m == 0:
				print(n)
			elif c + m == 4 or c + m == 3 or c + m == 5:
				print(n + 1)
			elif c < m:
				if c * 2 <= m:
					print(n + c)
				else:
					teamNum = m - c
					c -= teamNum
					if c % 3 == 0 or c % 3 == 1:
						print(n + c // 3 * 2 + teamNum)
					elif c % 3 == 2:
						print(n + c // 3 * 2 + 1 + teamNum)
			elif c > m:
				if 2 * m <= c:
					print(n + m)
				else:
					teamNum = c - m
					m -= teamNum
					if m % 3 == 0 or m % 3 == 1:
						print(n + m // 3 * 2 + teamNum)
					elif m % 3 == 2:
						print(n + m // 3 * 2 + 1 + teamNum)
			elif c % 3 == 0 or c % 3 == 1:
				print(n + c // 3 * 2)
			elif c % 3 == 2:
				print(n + c // 3 * 2 + 1)


t = int(input())
for i in range(t):
	(c, m, x) = map(int, input().split())
	r = min(c, m)
	a = abs(c - m) + x
	if a >= r:
		print(r)
	else:
		print((2 * r + a) // 3)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	m = min(a, b, c)
	a -= m
	b -= m
	c -= m
	(a, b) = (max(a, b), min(a, b))
	team = min(a - b, b)
	a -= 2 * team
	b -= team
	if a * b:
		team += (a + b) // 3
	print(m + team)


q = int(input())
l = []
for i in range(q):
	l.append(list(map(int, input().split())))
for i in range(q):
	max = min(l[i][0], l[i][1])
	s = (l[i][0] + l[i][1] + l[i][2]) // 3
	print(min(s, max))


q = int(input())
ans = []
for i in range(q):
	c_m_x = input().split()
	(c, m, x) = (int(c_m_x[0]), int(c_m_x[1]), int(c_m_x[2]))
	r = (c + m + x) // 3
	lst = [max(c, m), min(c, m), x]
	l = 0
	if l + 1 == r:
		mid = r
		if min(lst[0], lst[1]) >= mid and lst[2] + (lst[0] - mid + lst[1] - mid) >= mid:
			l = mid
			ans.append(str(l))
			continue
	while l + 1 < r:
		mid = (l + r) // 2
		if min(lst[0], lst[1]) >= mid and lst[2] + (lst[0] - mid + lst[1] - mid) >= mid:
			l = mid
		else:
			r = mid
		if l + 1 == r:
			mid = r
			if min(lst[0], lst[1]) >= mid and lst[2] + (lst[0] - mid + lst[1] - mid) >= mid:
				l = mid
	ans.append(str(l))
print('\n'.join(ans))


t = int(input())
for _ in range(t):
	(c, m, x) = [int(x) for x in input().split()]
	res = 0
	tmp = min(c, m, x)
	res += tmp
	c -= tmp
	m -= tmp
	x -= tmp
	if c < 1 or m < 1:
		print(res)
		continue
	if c > m:
		tmp = min(c - m, m)
		c -= 2 * tmp
		m -= tmp
		res += tmp
	else:
		tmp = min(m - c, c)
		m -= 2 * tmp
		c -= tmp
		res += tmp
	res += min(m, c) * 2 // 3
	print(res)


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	s = a + b + c
	s = s // 3
	if s <= b:
		print(s)
	else:
		print(b)


q = int(input())
for _ in range(q):
	(c, m, x) = list(map(int, input().split()))
	s = c + m + x
	i = min(c, m)
	if s // 3 <= i:
		print(s // 3)
	else:
		print(min(i, s - i * 2))


import math
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	count = 0
	run = True
	if c > x and m > x or c == m == x:
		count += x
		c -= x
		m -= x
		x = 0
	elif c < m:
		count = c
		run = False
	elif m < c:
		count = m
		run = False
	elif c == m:
		count = c
		run = False
	while run:
		if c == 0 or m == 0:
			break
		if c / m <= 0.5:
			count += c
			run = False
			continue
		elif m / c <= 0.5:
			count += m
			run = False
			continue
		if c == m:
			count += math.floor(c * 2 / 3)
			break
		elif c > m:
			diff = c - m
			c -= 2 * diff
			m -= diff
			count += diff
		elif m > c:
			diff = m - c
			c -= diff
			m -= 2 * diff
			count += diff
	print(count)


q = int(input())
for i in range(q):
	count = 0
	inp = input().split()
	c = int(inp[0])
	m = int(inp[1])
	x = int(inp[2])
	teams = (c + m + x) / 3
	teams = min(min(c, m), teams)
	print(int(teams))


n = int(input())
for i in range(n):
	(m, x, c) = list(map(int, input().split()))
	ans = min(m, x, c)
	m -= ans
	x -= ans
	c -= ans
	if m == 0 or x == 0:
		print(ans)
		continue
	else:
		differenc = abs(m - x)
		c += differenc
		if m > x:
			m -= differenc
		else:
			x -= differenc
		newAns = min(m, x, c)
		c -= newAns
		m -= newAns
		x -= newAns
		ans += newAns
		if m == 0 or x == 0:
			print(ans)
			continue
		else:
			ans += (m + x) // 3
	print(ans)


def solve(a, b, c):
	res = 0
	while a > 0 and b > 0 and (c > 0 or a + b > 2):
		if c > 0:
			d = min(a, b, c)
			a -= d
			b -= d
			c -= d
			res += d
		elif a != b:
			if b > a:
				(a, b) = (b, a)
			c += a - b
			a -= c
		else:
			res += (a + b) // 3
			break
	return res
tests = int(input())
for _ in range(tests):
	(a, b, c) = [int(x) for x in input().split()]
	print(solve(a, b, c))


for _ in range(int(input())):
	x = [int(n) for n in input().split()]
	c = x[0]
	m = x[1]
	n = x[2]
	print(min(min(c, m), sum(x) // 3))


import math
from collections import defaultdict
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	ans = 0
	if min(c, m, x) == x:
		p1 = min(c, m)
		ans += x
		c -= x
		m -= x
		print(min(p1, ans + (c + m) // 3))
	else:
		s = min(c, m, x)
		c -= s
		m -= s
		x -= s
		ans += s
		print(ans)


def solve(a, b, c):
	m = min(a, b)
	if c >= m:
		return m
	a -= c
	b -= c
	return c + min(a, b, (a + b) // 3)
n = int(input())
for _ in range(n):
	print(solve(*[int(x) for x in input().split()]))


import sys

def ku():
	pop = 0
	(c, m, x) = map(int, sys.stdin.readline().split())
	if x < c and x < m:
		c -= x
		m -= x
		co = x
		if m > c:
			x = m - c
			m = c
		else:
			x = c - m
			c = m
		if x > m:
			x = m
		sys.stdout.write(str(co + (c + m + x) // 3) + '\n')
	else:
		sys.stdout.write(str(min(c, m)) + '\n')
n = int(input())
for i in range(n):
	ku()


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	if c > 0 and m > 0:
		if c > m:
			if x >= m:
				print(m)
			elif (c + m + x) // 3 <= m:
				print((c + m + x) // 3)
			else:
				print(m)
		elif x >= c:
			print(c)
		elif (c + m + x) // 3 <= c:
			print((c + m + x) // 3)
		else:
			print(c)
	else:
		print(0)


n = int(input())
for i in range(n):
	(c, m, x) = list(map(int, input().split()))
	res = min(c, m)
	if c + m + x - 2 * res >= res:
		print(res)
	else:
		print((c + m + x) // 3)


q = int(input())

def IsPossible(a, b, c, x):
	rem_a = a - x
	rem_b = b - x
	if rem_a >= 0 and rem_b >= 0 and (rem_a + rem_b + c >= x):
		return True
	return False
for i in range(q):
	(a, b, c) = map(int, input().split())
	Min = min(a, b, c)
	Max = max(a, b, c)
	while Min <= Max:
		Mid = (Min + Max) // 2
		if IsPossible(a, b, c, Mid):
			Min = Mid + 1
		else:
			Max = Mid - 1
	print(Max)


int_inp = lambda : int(input())
strng = lambda : input().strip()
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
import math
from collections import Counter, defaultdict
for _ in range(int_inp()):
	(n, m, k) = mul()
	print(min(n, m, (n + m + k) // 3))


def check(c, m, x):
	a = min(c, m)
	a = min(a, x)
	(c, m, x) = (c - a, m - a, x - a)
	if c == 0 or m == 0:
		return a
	else:
		b = c + m
		b = int(b / 3)
		a += min(b, min(c, m))
		return a
q = int(input())
for i in range(q):
	(c, m, x) = input().split()
	(c, m, x) = (int(c), int(m), int(x))
	result = check(c, m, x)
	print(result)


import sys
import math

def solve(a: int, b: int, c: int):
	ideal = min(a, b)
	a -= ideal
	b -= ideal
	rest = a + b + c
	option2 = ideal - math.ceil((ideal - rest) / 3)
	ideal = min(ideal, option2)
	print(ideal)
q = int(input())
while q != 0:
	(a, b, c) = input().split()
	solve(int(a), int(b), int(c))
	q -= 1
pass


from math import floor
n = int(input())
results = ''
for query in range(n):
	(c, m, x) = list(map(int, input().split()))
	lowerUpperBound = min(c, m)
	upperUpperBound = floor((c + m + x) / 3)
	results = results + str(min(lowerUpperBound, upperUpperBound)) + '\n'
print(results[:-1])


t = int(input())
for nt in range(t):
	(c, m, x) = map(int, input().split())
	max_teams = (c + m + x) // 3
	s = c + m + x
	a = min(c, m)
	if 2 * min(c, m) <= s - min(c, m):
		print(min(c, m))
	else:
		count = x
		m = m - x
		c = c - x
		count += min(min(m, c), (m + c) // 3)
		print(count)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	team = min(c, m, x)
	if team == c or team == m:
		print(team)
	else:
		c -= x
		m -= x
		team += min((c + m) // 3, min(c, m))
		print(team)


Q = int(input())
for q in range(Q):
	(c, m, x) = map(int, input().split())
	all = c + m + x
	r = min(c, m)
	res = min(r, all // 3)
	print(res)


from sys import setcheckinterval, stdin, setrecursionlimit
setcheckinterval(1000)
setrecursionlimit(10 ** 7)

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

def lin():
	return list(map(int, stdin.readline().split()))
for _ in range(iin()):
	(c, m, x) = lin()
	mn = min(c, m)
	sm = m + c + x
	print(min(sm // 3, mn))


for i in range(int(input())):
	l = list(map(int, input().split()))
	if min(l) == l[2]:
		a = l[0] - l[2]
		b = l[1] - l[2]
		k = max(a, b)
		y = min(a, b)
		if k >= 2 * y:
			print(l[2] + y)
		else:
			print((k + y) // 3 + l[2])
	else:
		print(min(l))


q = int(input())
a = []
for j in range(q):
	(c, m, x) = list(map(int, input().strip().split()))
	max_possible = min(c, m)
	if c < m:
		remaining = m - c + x
	elif m < c:
		remaining = c - m + x
	elif m == c:
		remaining = x
	ans = 0
	E = max_possible - remaining
	if E % 3 == 2:
		extra = 1
	else:
		extra = 0
	if max_possible > remaining:
		ans = remaining + 2 * (E // 3) + extra
	else:
		ans = max_possible
	a.append(str(ans))
print('\n'.join(a))


q = int(input())
for you in range(q):
	l = input().split()
	c = int(l[0])
	m = int(l[1])
	x = int(l[2])
	a = max(m, c)
	b = min(m, c)
	if b <= x:
		print(b)
	else:
		a -= x
		b -= x
		if a >= 2 * b:
			print(b + x)
		else:
			print((a + b) // 3 + x)


n = int(input())
for i in range(n):
	arr = list(map(int, input().split()))
	final = 0
	min3 = min(arr[0], arr[1], arr[2])
	final += min3
	for j in range(3):
		arr[j] -= min3
	if arr[0] == 0 or arr[1] == 0:
		print(final)
	else:
		print(final + min(arr[0], arr[1], (arr[0] + arr[1]) // 3))


for _ in range(int(input())):
	(a, b, x) = map(int, input().split())
	cnt = min(a, b, x)
	a -= cnt
	b -= cnt
	cnt += min(a, b, (a + b) // 3)
	print(cnt)


tes = int(input())
for i in range(0, tes):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	ans = 0
	if c == min(a, b, c):
		a = a - c
		b = b - c
		ans = ans + c
		if a >= 2 * b or b >= 2 * a:
			print(min(a, b) + c)
		else:
			print((a + b) // 3 + c)
	else:
		print(min(a, b, c))


import sys, math
input = sys.stdin.readline

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

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(a, b, c) = invr()
	ans = -1
	hi = max(a, b, c)
	lo = 0
	while hi >= lo:
		mid = (hi + lo) // 2
		A = a
		B = b
		C = c
		A -= mid
		B -= mid
		if A < 0 or B < 0:
			hi = mid - 1
		else:
			temp = A + B + C
			if temp >= mid:
				ans = max(ans, mid)
				lo = mid + 1
			else:
				hi = mid - 1
	print(ans)


for i in range(int(input())):
	(C, M, X) = [int(n) for n in input().split()]
	print(min(C, M, (C + M + X) // 3))


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
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(ri(1)):
	(a, b, c) = ri()
	total = min(a, b)
	ca = a
	cb = b
	cc = c
	to_add = total
	a = a - total
	b = b - total
	ans = 0
	if to_add <= a + b + c:
		ans = to_add
	elif a == 0:
		temp = min(c, to_add)
		to_add -= temp
		ans = temp
		now = min((b + to_add * 2) // 3, to_add)
		ans += now
	else:
		temp = min(c, to_add)
		to_add -= temp
		ans = temp
		now = min((a + to_add * 2) // 3, to_add)
		ans += now
	print(ans)


for TT in range(1, int(input()) + 1):
	(c, m, x) = map(int, input().split())
	(a, b) = sorted([c, m])
	d = min(a, x)
	res = d
	a -= d
	b -= d
	res += min((a + b) // 3, a)
	print(res)


import math
elem = int(input())
for x in range(elem):
	ar = []
	for t in input().split(' '):
		ar.append(int(t))
	total = math.floor(sum(ar) / 3)
	if ar[0] < ar[1]:
		if ar[0] < total:
			print(ar[0])
		else:
			print(total)
	elif ar[1] < total:
		print(ar[1])
	else:
		print(total)


qc = int(input())
for qq in range(qc):
	(c, m, x) = map(int, input().split())
	if x >= min(c, m):
		print(min(c, m))
	else:
		print(min(min(c, m), int((c + m + x) / 3)))


def result(x, y, z):
	if z >= x or z >= y:
		return min(x, y)
	x -= z
	y -= z
	if x >= 2 * y:
		return y + z
	if y >= 2 * x:
		return x + z
	else:
		return (x + y) // 3 + z
q = int(input())
for qq in range(q):
	(x, y, z) = map(int, input().split())
	print(result(x, y, z))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	cm = min(c, m)
	x += m - cm + c - cm
	if x < cm:
		diff = (cm - x) // 3 - 3
		x += 2 * diff
		cm -= diff
	while x < cm:
		x += 2
		cm -= 1
	print(max(0, min(cm, x)))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	kol = min(c, m, x)
	c -= kol
	m -= kol
	x -= kol
	if c == 0 or m == 0:
		print(kol)
	else:
		(l, r) = (0, min(c, m) + 1)
		while r - l > 1:
			mid = (r + l) // 2
			ost = c - mid + m - mid - mid
			if ost >= 0:
				l = mid
			else:
				r = mid
		print(kol + l)


import sys
import math
import bisect

def query(t, a, b, c):
	if a < t or b < t:
		return False
	c += a - t
	c += b - t
	return c >= t

def solve(a, b, c):
	left = 0
	right = 10 ** 18
	while right - left > 1:
		mid = (left + right) // 2
		if query(mid, a, b, c):
			left = mid
		else:
			right = mid
	return left

def main():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		ans = solve(a, b, c)
		print(ans)
main()


for _ in range(int(input())):
	l = list(map(int, input().split()))
	(c, m, x) = (l[0], l[1], l[2])
	p = min(c, m, x)
	if p == c:
		print(p)
	elif p == m:
		print(p)
	else:
		c -= p
		m -= p
		u = (c + m) // 3
		p += min(u, c, m)
		print(p)


cc = int(input())
while cc:
	(a, b, c) = map(int, input().split())
	x = min([a, b, c])
	a -= x
	b -= x
	c -= x
	sum = 0
	sum += x
	if c == 0:
		if a > b:
			(a, b) = (b, a)
		if 2 * a <= b:
			sum += a
		else:
			sum += int((a + b) / 3)
	print(sum)
	cc -= 1


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	ans = 0
	if c > m:
		c = m + c
		m = c - m
		c = c - m
	if x >= c:
		ans += c
	elif x < c:
		ans += x
		c -= x
		m -= x
		if m >= 2 * c:
			ans += c
		else:
			ans += (c + m) // 3
	print(ans)


for k in range(int(input())):
	(c, m, x) = map(int, input().split())
	a = min(c, m)
	x += max(c, m) - a
	if x >= a:
		print(a)
	elif (a - x) % 3 == 0:
		v = (a - x) // 3
		x += v * 2
		print(min(a - v, x))
	else:
		v = (a - x) // 3 + 1
		x += v * 2
		print(min(a - v, x))


for _ in range(int(input().strip())):
	(c, m, x) = list(map(int, input().split()))
	total = c + m + x
	max_teams = total // 3
	team = min(c, m)
	if team >= max_teams:
		print(max_teams)
	else:
		print(team)


n = int(input())
for i in range(n):
	(k, m, x) = map(int, input().split())
	mi = min(k, m)
	if mi * 3 <= k + m + x:
		print(mi)
	else:
		print((k + m + x) // 3)


q = int(input())
for i in range(q):
	(c, m, n) = map(int, input().split())
	x = min(c, m)
	y = c + m + n - x
	if y >= 2 * x:
		print(x)
	else:
		res1 = y // 2
		p = y % 2
		q = x - res1
		res2 = (p + q) // 3
		print(res1 + res2)


q = int(input())
I = []
for i in range(q):
	s = list((int(x) for x in input().split()))
	I.append(s)
F = []
for i in range(q):
	(c, m, x) = (I[i][0], I[i][1], I[i][2])
	v = abs(c - m)
	x += v
	if c > m:
		c -= v
	else:
		m -= v
	R = min(c, m, x)
	c -= R
	m -= R
	x -= R
	R += (c + m) // 3
	F.append(R)
for i in F:
	print(i)


q = int(input())
for i in range(q):
	(c, m, x) = [int(el) for el in input().split()]

	def f(n):
		if n * 3 > c + m + x:
			return False
		if n > c or n > m:
			return False
		return True
	l = 0
	r = 1000000000000000000
	while r - l > 1:
		m1 = (r + l) // 2
		if f(m1):
			l = m1
		else:
			r = m1
	print(l)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	maxi = (c + m + x) // 3
	if c >= m:
		if m <= maxi:
			print(m)
		elif m > maxi:
			print(maxi)
	elif c <= maxi:
		print(c)
	else:
		print(maxi)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	s = 0
	minw = min(c, m, x)
	s += minw
	c -= minw
	m -= minw
	x -= minw
	if c == 0 or m == 0:
		print(s)
		continue
	else:
		mi = min(c, m)
		mx = max(c, m)
		r = mx - mi
		if r >= mi:
			s += mi
			print(s)
			continue
		else:
			mi -= r
			mx -= 2 * r
			s += r
		add = mi // 3
		s += add * 2
		mi -= add * 3
		mx -= add * 3
		if mi == 2:
			s += 1
		print(s)


def check(c, m, x, num):
	if num == 0:
		return True
	if num > c or num > m:
		return False
	c -= num
	m -= num
	if num > c + m + x:
		return False
	return True
for _ in range(int(input())):
	(c, m, x) = [int(i) for i in input().split()]
	l = 0
	r = max(c, m)
	while l < r:
		mid = (l + r + 1) // 2
		if check(c, m, x, mid):
			l = mid
		else:
			r = mid - 1
	if check(c, m, x, l):
		print(l)
	else:
		print(0)


for i in range(int(input())):
	(c, m, n) = map(int, input().split())
	s = c + m + n
	if s // 3 <= min(c, m):
		print(s // 3)
	else:
		print(min(c, m))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	x += abs(c - m)
	(c, m) = (min(c, m), min(c, m))
	if x >= c:
		print(c)
	else:
		ans = x
		c -= x
		m -= x
		print(ans + (m + c) // 3)


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

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

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def b_search(n):
	l = 1
	r = n // 2 + 1
	ans = 1
	while l <= r:
		mid = l + (r - l) // 2
		a = mid
		b = int(ceil(n / a))
		if a * b >= n:
			ans = a
		if abs(a - b) >= 2:
			l = mid + 1
		else:
			r = mid - 1
	return (ans, int(ceil(n / ans)))

def main():
	t = inp()
	for _ in range(t):
		(c, m, x) = invr()
		res = min((c + m + x) // 3, min(c, m))
		print(res)
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
import functools
from collections import deque
sin = sys.stdin
q = int(sin.readline())
for i in range(q):
	arr = sin.readline().split()
	arr = [int(x) for x in arr]
	c = arr[0]
	m = arr[1]
	x = arr[2]
	mTeams = min(min(c, m), int((c + m + x) / 3))
	print(mTeams)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split(' '))
	team = 0
	if c >= x and m >= x:
		team = team + x
		c = c - x
		m = m - x
		x = 0
		if c > 0 and m > 0:
			a = max(c, m)
			b = min(c, m)
			if b != a and b > 0 and (a > 0):
				if 2 * b <= a:
					team = team + b
				else:
					n = a - b
					b = b - n
					a = a - 2 * n
					team = team + n
			if c > 0 and m > 0:
				if a == b:
					if a % 3 == 0 or a % 3 == 1:
						team = team + 2 * (a // 3)
					elif a % 3 == 2:
						team += 2 * (a // 3) + 1
		print(team)
	else:
		team = team + min(c, m)
		print(team)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	team = min(c, m)
	c -= team
	m -= team
	x += c + m
	if team <= x:
		print(team)
	else:
		d = (team - x) // 3
		d1 = d + 1
		d2 = d - 1
		t = min(team - d, x + 2 * d)
		t1 = min(team - d1, x + 2 * d1)
		t2 = min(team - d2, x + 2 * d2)
		print(max(t, t1, t2))


a = int(input())
b = []
for x in range(a):
	b.append([int(x) for x in input().split()])
for x in range(a):
	g = min(b[x][1], b[x][0], int((b[x][1] + b[x][2] + b[x][0]) / 3))
	print(g)


t = int(input())
for i in range(t):
	inp = input().split()
	c = int(inp[0])
	m = int(inp[1])
	x = int(inp[2])
	ans = min(c, m)
	if c + m + x >= ans * 3:
		print(ans)
	else:
		print(min(ans, (c + m + x) // 3))


n = int(input())
while n:
	(x, y, z) = map(int, input().split())
	vals = min(x, y, (x + y + z) // 3)
	print(vals)
	n -= 1


a = int(input())
for i in range(a):
	(c, m, x) = map(int, input().split())
	mi = c
	if m < c:
		mi = m
	if mi == c:
		k = (m + x) // 2
		if mi <= k:
			print(mi)
		else:
			print(mi if mi < (c + m + x) // 3 else (c + m + x) // 3)
		continue
	if mi == m:
		k = (c + x) // 2
		if mi <= k:
			print(mi)
		else:
			print(mi if mi < (c + m + x) // 3 else (c + m + x) // 3)


t = int(input())
for t1 in range(0, t):
	(a, b, c) = map(int, input().split())
	z = min(a, b)
	k = (a + b) // 3
	s = a + b + c
	print(min(s // 3, z))


q = int(input())
for i in range(q):
	list = str.split(input())
	c = int(list[0])
	m = int(list[1])
	x = int(list[2])
	sum = c + m + x
	min2 = min(c, m, x)
	count = 0
	if c != 0 and m != 0 and (sum >= 3):
		if min2 == x:
			count += x
			m -= x
			c -= x
			min1 = min(c, m)
			min3 = min(min1, (c + m) // 3)
			count += min3
		else:
			min1 = min(c, m)
			count += min1
	print(count)


from sys import stdin
input = stdin.readline
q = int(input())
for _ in range(q):
	(c, m, x) = [int(x) for x in input().split()]
	x += abs(c - m)
	c = m = min(c, m)
	if x < c:
		a = (c - x) // 3
		b = (c - x) // 3 + ((c - x) % 3 > 0)
		ans = max(min(c - a, x + 2 * a), min(c - b, x + 2 * b))
	else:
		ans = c
	print(ans)


t = int(input())
for i in range(t):
	(c, m, n) = [int(x) for x in input().split()]
	result = min(c, m, (c + m + n) // 3)
	print(result)


q = int(input())
for i in range(q):
	(c, m, x) = [int(x) for x in input().split()]
	n_teams = (c + m + x) // 3
	print(min(n_teams, min(c, m)))


for _ in range(int(input())):
	X = list(map(int, input().split()))
	print(min(min(X[:2]), sum(X) // 3))


q = int(input())
while q:
	(c, m, x) = map(int, input().split())
	a = min(c, m)
	c -= a
	m -= a
	if c + m + x >= a:
		print(a)
	elif c + m + x >= 0:
		print(c + m + x + (a - c - m - x) * 2 // 3)
	else:
		print(2 * a // 3)
	q -= 1


def main():
	d = int(input())
	for i in range(d):
		(c, m, x) = [int(v) for v in input().split()]
		print(min([c, m, (c + m + x) // 3]))
main()


def ain():
	return map(int, input().split())
for _ in range(int(input())):
	(c, m, x) = ain()
	minp = min(c, m)
	rem = max(c - minp, m - minp)
	minv = min(minp, rem + x)
	if minp <= rem + x:
		print(minp)
	else:
		print(minv + 2 * (minp - minv) // 3)


t = int(input())
for tt in range(t):
	s = list(map(int, input().split()))
	(c, m, n) = (s[0], s[1], s[2])
	if c == 0 or m == 0:
		print('0')
	else:
		x = min(c, m, n)
		c -= x
		m -= x
		n -= x
		if c == 0 or m == 0:
			print(x)
		else:
			y = min(c, m)
			z = max(c, m)
			if z > 2 * y:
				z = 2 * y
			print(x + (y + z) // 3)


import math

def value():
	return int(input())

def li():
	return [int(_______) for _______ in input().split()]
from collections import *
for _ in range(int(input())):
	(a, b, c) = li()
	mi = min(a, b)
	a -= mi
	b -= mi
	rem = a + b + c
	if rem >= mi or mi == 0:
		print(mi)
	else:
		rem = mi - rem
		ans = math.ceil(rem / 3)
		print(max(mi - ans, 0))


import sys
import math
q = int(sys.stdin.readline())
while q:
	(c, m, x) = map(int, sys.stdin.readline().split())
	if min(c, m) <= x:
		print(min(c, m))
	else:
		ans = x + (c - x + m - x) // 3
		print(min(c, m, ans))
	q -= 1


import sys
queries = int(sys.stdin.readline().strip())
data = []
try:
	for i in range(queries):
		line = sys.stdin.readline().strip()
		lines = list(map(int, line.split()))
		data.append(lines)
except:
	pass
for pair in data:
	(a, b, c) = pair
	m = min(a, b, c)
	(a, b, c) = (a - m, b - m, c - m)
	x = min((a + b) // 3, min(a, b))
	print(x + m)


q = int(input())
for _ in range(q):
	arr = list(map(int, input().split()))
	c = arr[0]
	m = arr[1]
	x = arr[2]
	if c == 0 or m == 0:
		print(0)
	else:
		s = c + m + x
		d = s // 3
		if d <= c and d <= m:
			print(d)
		else:
			print(min(c, m))


T = int(input())
for _ in range(T):
	line = input()
	line = line.strip().split()
	line = list(map(int, line))
	c = line[0]
	m = line[1]
	x = line[2]
	if c == 0 or m == 0 or sum(line) < 3:
		res = 0
	if c <= m and c <= (c + m + x) / 3:
		res = c
	elif m <= c and m <= (c + m + x) / 3:
		res = m
	else:
		res = int((c + m + x) / 3)
	print(res)


for i in range(int(input())):
	(c, m, x) = list(map(int, input().split()))
	count = min(x + max(c, m) - min(c, m), c, m)
	if c > m:
		c -= max(c, m) - min(c, m)
	else:
		m -= max(c, m) - min(c, m)
	i = c - count
	j = m - count
	count += (i + j) // 3
	print(count)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = min(a, b)
	c += a - ans + (b - ans)
	if ans - c < 0:
		print(ans)
	else:
		ans -= math.ceil((ans - c) / 3)
		print(ans)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	temp = min(c, m)
	total = c + m + x
	frac = total // 3
	print(min(frac, temp))


q = int(input())
while q:
	(c, m, x) = [int(x) for x in input().split()]
	maxPossibleTeams = min(c, m)
	totStu = c + m + x
	if totStu < maxPossibleTeams * 3:
		ans = totStu // 3
	else:
		ans = maxPossibleTeams
	print(ans)
	q = q - 1


for q in range(int(input())):
	(c, m, x) = list(map(int, input().split()))
	a = min(c, m, (c + m + x) // 3)
	print(a)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	a = min(c, m)
	b = max(c, m)
	k = max(2 * a - b - x, 0)
	if k % 3 == 0:
		print(a - k // 3)
	else:
		print(a - k // 3 - 1)


def ans(c, m, x):
	print(min(c, m, (c + m + x) // 3))
n = int(input())
for _ in range(n):
	(c, m, x) = map(int, input().split())
	ans(c, m, x)


t = 1
t = int(input())
while t:
	t -= 1
	(c, m, x) = list(map(int, input().split()))
	print(min(c, m, (c + m + x) // 3))


import math
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	t1 = max(c, m)
	t2 = min(c, m)
	ans = 0
	if c == min(c, m, x):
		ans = c
	elif m == min(c, m, x):
		ans = m
	else:
		ans = x
		c = c - x
		m = m - x
		ex = max(c - m, m - c)
		if ex > min(c, m):
			ans += min(c, m)
		else:
			ans += ex
			t = min(c, m)
			c = t
			m = t
			c = c - ex
			m = m - ex
			ans += (c + m) // 3
	print(ans)


for _ in range(int(input())):
	(a, b, c) = [int(j) for j in input().split()]
	res = min(b, c)
	a -= res
	b -= res
	c -= res
	res += min(int((a + b) / 3), a, b)
	print(res)


q = int(input())
while q > 0:
	(c, m, x) = [int(i) for i in input().split()]
	diff = max(c, m) - min(c, m)
	x += diff
	if c > m:
		c -= diff
	else:
		m -= diff
	count = 0
	minv = min(c, m, x)
	c -= minv
	m -= minv
	x -= minv
	count += minv
	count += int((c + m) / 3)
	print(count)
	q -= 1


t = int(input())
for q in range(0, t):
	(x, y, z) = map(int, input().split())
	m = min(x, y, z)
	ans = 0
	if m == x or m == y:
		ans = m
	else:
		ans = m
		x -= m
		y -= m
		ans += min(min(x, y), (x + y) // 3)
	print(ans)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split(' '))
	if min(c, m, x) == c or min(c, m, x) == m:
		print(min(c, m, x))
	else:
		s = x
		c = c - x
		m = m - x
		if m == c:
			s += m // 3 * 2
			if m % 3 == 2:
				s += 1
		else:
			y = min(m, c)
			if y == m:
				c = c - m
				if c >= m:
					s += m
				else:
					s += c
					m = m - c
					s += m // 3 * 2
					if m % 3 == 2:
						s += 1
			else:
				m = m - c
				if m >= c:
					s += c
				else:
					s += m
					c = c - m
					s += c // 3 * 2
					if c % 3 == 2:
						s += 1
		print(s)


q = int(input())
for i in range(q):
	a = input().split()
	a = list(map(int, a))
	s = 0
	for j in range(3):
		s += a[j]
	m = min(a[0], a[1])
	mm = min(m, s // 3)
	print(mm)


n = int(input())
for i in range(n):
	l = list(map(int, input().split(' ')))
	count = int
	count = 0
	sum = int
	sum = 0
	p = 0
	j = 0
	c = min(l)
	k = l.index(c)
	if k == 0 or k == 1:
		count += c
	else:
		count += c
		if l[0] - c != 0 or l[1] - c != 0:
			p = int((l[0] - c + (l[1] - c)) / 3)
			if p <= min(l[0] - c, l[1] - c):
				count += p
			else:
				count += min(l[0] - c, l[1] - c)
	print(count)


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(c, m, n) = map(int, input().split())
	x = min(c, m, n)
	c -= x
	m -= x
	n -= x
	if c == 0 or m == 0 or c + m == 2:
		print(x)
		continue
	if c > m:
		(c, m) = (m, c)
	if m >= 2 * c:
		print(x + c)
		continue
	if c != m:
		y = 2 * c - m
		x += c - y
		c = y
		m = y
	if c % 3 < 2:
		print(x + 2 * (c // 3))
	else:
		print(x + 2 * (c // 3) + 1)


for q in range(int(input())):
	(c, m, x) = [int(i) for i in input().split()]
	if c < m:
		(m, c) = (c, m)
	ex = c - m + x
	tot = c + m + x
	print(min(m, tot // 3))


T = int(input())
while T:
	T -= 1
	(c, m, x) = map(int, input().split())
	print(min(c, m, int((c + m + x) / 3)))


n = int(input())
while n:
	(a, b, c) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	print(min(b, (a + b + c) // 3))
	n -= 1


import sys

def read():
	return sys.stdin.readline()

def main():
	q = int(read())
	for i in range(q):
		(c, m, x) = list(map(int, read().split()))
		if c <= m and c <= x:
			print(c)
		elif m <= c and m <= x:
			print(m)
		else:
			t = x
			c -= x
			m -= x
			q = min(m, c, (m + c) // 3)
			print(t + q)

def __starting_point():
	main()
__starting_point()


for t in range(int(input())):
	(c, m, n) = map(int, input().split())
	s = c + m + n
	if c <= m:
		if 3 * c <= s:
			print(c)
		else:
			print(s // 3)
	elif 3 * m <= s:
		print(m)
	else:
		print(s // 3)


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

def main():
	pass
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')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
for xyz in range(0, int(input())):
	(c, m, x) = map(int, input().split())
	print(min((c + m + x) // 3, c, m))


for _ in range(int(input())):
	(c, m, x) = [int(__) for __ in input().split()]
	print(min((c + m + x) // 3, min(c, m)))


T = int(input())
for t in range(T):
	(c, m, n) = map(int, input().split())
	(l, r) = (0, min(c, m))

	def success(num):
		rem_c = c - num
		rem_m = m - num
		if rem_c < 0 or rem_m < 0:
			return False
		rem_n = min(n, num)
		if rem_c + rem_m + rem_n >= num:
			return True
		return False
	while l <= r:
		mid = (l + r) // 2
		temp = success(mid)
		temp1 = success(mid + 1)
		if temp and temp1:
			l = mid + 1
		elif temp and (not temp1):
			print(mid)
			break
		else:
			r = mid - 1


q = int(input())
for tc in range(q):
	(c, m, x) = map(int, input().split())
	result = 0
	if min(c, m, x) == x:
		result = x
		c -= x
		m -= x
		result += min((c + m) // 3, c, m)
	else:
		result += min(c, m)
	print(result)


testCases = int(input())
for t in range(testCases):
	(c, m, x) = tuple(map(int, input().split(' ')))
	minimal = min(c, m)
	c -= minimal
	m -= minimal
	leftOver = c + m + x
	if minimal <= leftOver:
		print(minimal)
	else:
		answer = leftOver
		greatBrains = 2 * (minimal - leftOver)
		answer += greatBrains // 3
		print(answer)


for _ in ['fuad'] * int(input()):
	(c, m, x) = map(int, input().split())
	print(min(c, m, (c + m + x) // 3))


def solve():
	(a, b, c) = map(int, input().split())
	min1 = min(a, b)
	if min1 * 3 < a + b + c:
		print(min1)
	else:
		print((a + b + c) // 3)
n = int(input())
for i in range(0, n):
	solve()


from math import *
mod = 10 ** 9 + 7
for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	a = min(c, m)
	x += max(c, m) - a
	c = min(c, a)
	m = min(m, a)
	b = (x - c) // 3
	b1 = min(b - 1, 0)
	b2 = min(b, 0)
	print(max(min(c + b1, x - 2 * b1), min(c + b2, x - 2 * b2)))


n = int(input())
for _ in range(n):
	(a, b, c) = (int(i) for i in input().split())
	x = min(a, b)
	c += a - x + b - x
	if c >= x - 1:
		print(min(x, c))
		continue
	i = (x - c + 1) // 3
	print(min(x - i, c + 2 * i))


n = int(input())
for i in range(n):
	ans = 0
	t = [int(k) for k in input().split()]
	if t[2] <= t[0] and t[2] <= t[1]:
		t[0] -= t[2]
		t[1] -= t[2]
		ans += t[2]
		(m, n) = (t[0], t[1]) if t[0] <= t[1] else (t[1], t[0])
		if 2 * m > n:
			ans += (m + n) // 3
		else:
			ans += m
		print(ans)
	else:
		print(t[0] if t[0] <= t[1] else t[1])


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	total = a + b + c
	print(min(min(a, b), (a + b + c) // 3))


def cal(a, b):
	if a > 0 and b > 0 and (a + b >= 3):
		if a < b:
			x = min(a, (b - a + 1) // 2)
			return x + cal(a - x, b - 2 * x)
		elif a > b:
			x = min(b, (a - b + 1) // 2)
			return x + cal(a - 2 * x, b - x)
		else:
			return 2 * a // 3
	return 0
for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	if x == max(c, m, x):
		print(min(c, m))
	elif x == min(c, m, x):
		print(x + cal(c - x, m - x))
	else:
		print(min(c, m))


for _ in range(int(input())):
	d = [int(i) for i in input().split()]
	print(min((d[0] + d[1] + d[2]) // 3, d[0], d[1]))


qtd = int(input())
for i in range(qtd):
	(c, m, x) = map(int, input().split())
	lista = [c, m]
	if c < 1 or m < 1:
		print(0)
		continue
	elif min(lista) > 0:
		print(min(min(lista), (c + m + x) // 3))
		continue
	elif c > 0 and m > 0 and (x > 0):
		print((c + m + x) // 3)
		continue


def isValid(c, m, x, n):
	if min(c, m) < n:
		return False
	c -= n
	m -= n
	return c + m + x >= n
t = int(input())
for tc in range(t):
	(c, m, x) = map(int, input().split())
	low = 0
	ans = 0
	high = (c + m + x) // 3
	if c == 0 or m == 0:
		print(0)
	else:
		while low < high:
			mid = (low + high + 1) // 2
			if isValid(c, m, x, mid):
				ans = mid
				low = mid
			else:
				high = mid - 1
		print(high)


import math

def findMaxTeams(c, m, x):
	if x < c and x < m:
		answer = x
		m = m - x
		c = c - x
		(m, c) = (max(m, c), min(m, c))
		answer += (m + c) // 3 if m < 2 * c else c
		print(answer)
	else:
		print(min(m, c))
T = int(input())
for t in range(T):
	lst = list(map(int, input().split(' ')))
	findMaxTeams(lst[0], lst[1], lst[2])


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split(' '))
	n = 0
	t = min([c, m, x])
	n += t
	c -= t
	m -= t
	x -= t
	if c == 0 or m == 0:
		print(n)
	else:
		if c >= 2 * m:
			n += m
			c -= 2 * m
			m = 0
		elif m >= 2 * c:
			n += c
			m -= 2 * c
			c = 0
		elif m < c < 2 * m:
			k = c - m
			n += k
			m -= k
			c -= 2 * k
		elif c < m < 2 * c:
			k = m - c
			n += k
			c -= k
			m -= 2 * k
		n += 2 * min(c // 3, m // 3)
		c = c % 3
		m = m % 3
		while max(c, m) >= 2 and min(c, m) >= 1:
			if c >= m:
				c -= 2
				m -= 1
			else:
				c -= 1
				m -= 2
			n += 1
		print(n)


n = int(input())
aux1 = 0
while aux1 < n:
	entrada = input()
	vet = entrada.split(' ')
	c = int(vet[0])
	m = int(vet[1])
	x = int(vet[2])
	total = c + m + x
	grupo = 0
	possiveis = total // 3
	if total > 0 and possiveis >= 1:
		if c >= possiveis and m >= possiveis:
			grupo = possiveis
		elif c < m:
			grupo = c
		else:
			grupo = m
	print(grupo)
	aux1 += 1


def p2(a, b):
	dif = a - b
	if dif >= b:
		return b
	x = b - dif
	return dif + int(x // 1.5)

def solve():
	(c, m, x) = [int(a) for a in input().split(' ')]
	menor = min(c, m)
	if x >= menor:
		return menor
	m -= x
	c -= x
	if m < c:
		return x + p2(c, m)
	return x + p2(m, c)
q = int(input())
for i in range(q):
	print(solve())


from sys import stdin
from math import floor

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(int(input())):
	(c, m, x) = get_ints()
	total = c + m + x
	if min(c, m) == 0 or total < 3:
		print(0)
		continue
	k = min(c, m)
	if k <= x:
		print(k)
		continue
	else:
		print(min(total // 3, k))
		continue


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	q = min(a, b)
	l = 0
	r = min(a, b)
	ans = 0
	while l <= r:
		mid = (r + l) // 2
		if a + b + c >= 3 * mid:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	print(ans)


import math
for _ in range(int(input())):
	a = list(map(int, input().split()))
	maxxteams = min(a[0], a[1])
	a[2] = sum(a) - 2 * maxxteams
	if a[2] >= maxxteams:
		ans = maxxteams
	else:
		x = math.ceil((maxxteams - a[2]) / 3)
		maxxteams -= x
		a[2] += 2 * x
		ans = min(a[2], maxxteams)
	print(ans)


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def revn(n):
	m = 0
	while n > 0:
		m = m * 10 + n % 10
		n = n // 10
	return m
q = ii()
for i in range(q):
	(c, m, x) = mi()
	ans = 0
	if x == min(c, m, x):
		ans = +x
		c -= x
		m -= x
		if c > 2 * m or m > 2 * c:
			ans += min(c, m)
		else:
			ans += (c + m) // 3
		print(ans)
	else:
		print(min(c, m))


def createTeam(team: [int]):
	members = team[0] + team[1] + team[2]
	findMin = min(team[0], team[1])
	if findMin * 3 <= members:
		return findMin
	else:
		return int(members / 3)
user_input = input()
numberOfQ = int(user_input)
values = user_input.split(' ')
res = []
for i in range(0, numberOfQ):
	team_input = input()
	line = team_input.split(' ')
	values = [int(x) for x in line]
	res.append(values)
for item in res:
	print(createTeam(item))


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	tee = min(c, m)
	all = c + m + x
	tee2 = all // 3
	ans = min(tee, tee2)
	print(ans)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = min(a, b)
	if a + b + c >= 3 * d:
		print(d)
	else:
		print((a + b + c) // 3)


t = int(input())
while t > 0:
	t -= 1
	(c, m, x) = map(int, input().split())
	k = min(c, m)
	teams = int((c + m + x) / 3)
	print(min(teams, k))


q = int(input())
while q:
	q -= 1
	(c, m, x) = [int(x) for x in input().split()]
	if x >= min(c, m):
		print(min(c, m))
	else:
		count = x
		c -= x
		m -= x
		if c > m:
			(c, m) = (m, c)
		if c >= (m + c) // 3:
			print((m + c) // 3 + count)
		else:
			print(c + count)


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	t = min(c, m, x)
	c -= t
	m -= t
	x -= t
	if c > 0 and m > 0:
		t += min(c, m, (c + m) // 3)
	print(t)


query = int(input())
for _ in range(query):
	(c, m, x) = map(int, input().split())
	maxp = (c + m + x) // 3
	temp = min(c, m)
	m = max(c, m)
	c = temp
	if c < maxp:
		print(c)
	else:
		print(maxp)


import sys
input = sys.stdin.readline
q = int(input())
for testcases in range(q):
	(c, m, x) = map(int, input().split())
	print(min(c, m, (c + m + x) // 3))


q = int(input())
lis = []
for i in range(q):
	lis.append(list(map(int, input().split())))
for i in lis:
	a = sum(i) / 3
	b = min(i[0], i[1])
	print(int(min(a, b)))


n = int(input())
for i in range(n):
	l = [int(x) for x in input().split()]
	print(min(l[0], min(l[1], int((l[0] + l[1] + l[2]) / 3))))


for _ in range(int(input())):
	(p, q, s) = map(int, input().split())
	a = 0
	b = (p + q + s) // 3
	ans = 0
	while a <= b:
		mid = (a + b) // 2
		if p >= mid and q >= mid and ((p + q + s) // 3 >= mid):
			a = mid + 1
			ans = mid
		else:
			b = mid - 1
	print(ans)


import sys
s = int(input())
while s > 0:
	(c, m, x) = map(int, sys.stdin.readline().split())
	n1 = int((c + m + x) / 3)
	mini = c
	if mini > m:
		mini = m
	if mini > n1:
		mini = n1
	print(mini)
	s -= 1


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	p = (c + m + x) // 3
	if min(c, m) >= p:
		print(p)
	else:
		print(min(c, m))


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	mini = min([c, m, x])
	c -= mini
	m -= mini
	x -= mini
	if c == 0 or m == 0:
		print(mini)
	else:
		print(mini + min([(c + m) // 3, c, m]))


def max_groups(c, m, x):
	if c == min(c, m, x):
		return c
	elif m == min(c, m, x):
		return m
	elif x == 0:
		return min(c, m, (c + m) // 3)
	elif x == 1:
		return min(c, m, max(x - 1 + (c - x + 1 + (m - x + 1)) // 3, x + (c - x + (m - x)) // 3))
	else:
		return min(c, m, max(x - 1 + (c - x + 1 + (m - x + 1)) // 3, x + (c - x + (m - x)) // 3, x - 2 + (c - x + (m - x) + 4) // 3))
q = int(input())
for _ in range(q):
	(c, m, x) = [int(s) for s in input().split(' ')]
	print(max_groups(c, m, x))


n = int(input())
for _ in range(n):
	(c, m, x) = map(int, input().split())
	res = 0
	if c <= x or m <= x:
		res = min(c, m)
	else:
		res += x
		c -= x
		m -= x
		if c > m:
			if c >= 2 * m:
				res += m
			else:
				t = c - m
				res += t
				c -= 2 * t
				m -= t
				res += (c + m) // 3
		elif c < m:
			if m >= 2 * c:
				res += c
			else:
				t = m - c
				res += t
				c -= t
				m -= 2 * t
				res += (c + m) // 3
		else:
			res += (c + m) // 3
	print(res)


req = int(input())
a = []
for each in range(req):
	a.append(0)
for i in range(req):
	(co, ma, x) = map(int, input().split())
	j = min(co, ma, x)
	a[i] += j
	co -= j
	ma -= j
	if co != 0 and ma != 0:
		Ma = max(co, ma)
		Mi = min(co, ma)
		if Ma > Mi * 2:
			a[i] += Mi
		elif Ma == Mi:
			a[i] += co * 2 // 3
		else:
			a[i] += (co + ma) // 3
for eac in range(req):
	print(a[eac])


for _ in range(int(input())):
	(coders, mathematicians, students) = map(int, input().split())
	all_participants = coders + mathematicians + students
	min_spec = min(coders, mathematicians)
	if all_participants // 3 > min_spec:
		print(min_spec)
	else:
		print(all_participants // 3)


n = int(input())
for i in range(n):
	(coder, math, none) = [int(x) for x in input().split()]
	bestCase = (coder + math + none) / 3
	if coder >= bestCase and math >= bestCase:
		result = bestCase
	elif coder < math:
		result = coder
	else:
		result = math
	print(int(result))


import sys

def solve(C, M, X):
	if C <= M:
		low = C
		high = M
	else:
		low = M
		high = C
	if low < (high + X) / 2:
		return low
	else:
		HX = high + X
		can_do = int(HX / 2)
		return can_do + int((low - can_do + HX % 2) / 3)

def main():
	Q = int(input())
	while Q:
		members = [int(i) for i in sys.stdin.readline().split()]
		print(solve(*members))
		Q -= 1
main()


q = int(input())

def min(a, b):
	if a < b:
		return a
	else:
		return b

def max(a, b):
	if a > b:
		return a
	else:
		return b
for i in range(q):
	(c, m, x) = input().split(' ')
	c = int(c)
	m = int(m)
	x = int(x)
	maximum = max(c, m)
	minimum = min(c, m)
	print(min(int((c + m + x) / 3), minimum))


t = int(input())
for _ in range(t):
	(c, m, s) = map(int, input().split())
	result = 0
	result = min(c, m, s)
	(c, m) = (c - result, m - result)
	(mini, maxi) = (min(c, m), max(c, m))
	if maxi // 2 >= mini:
		result += mini
	else:
		result += maxi - mini
		(maxi, mini) = (maxi - (maxi - mini) * 2, mini - (maxi - mini))
	if mini == maxi:
		result += (mini + maxi) // 3
	print(result)


def team(m, c, bc):
	teams = 0
	if m == 0 or c == 0 or m + c + bc < 3:
		return 0
	if c >= bc:
		m -= bc
		c -= bc
		teams += bc
		bc = 0
		return teams + min(int((m + c) / 3), min(m, c))
	else:
		return min(c, int((m + c + bc) / 3))
n = int(input())
l = []
for i in range(n):
	(p, q, r) = [int(k) for k in input().split(' ')]
	if q > p:
		(p, q) = (q, p)
	l.append(team(p, q, r))
print('\n'.join((str(k) for k in l)))


a = int(input())
fin = []
for j in range(a):
	ls = [int(i) for i in input().strip().split()]
	c = ls[0]
	m = ls[1]
	x = ls[2]
	min_ = min(c, m)
	players = c + m + x
	if 3 * min_ > players:
		fin.append(players // 3)
	else:
		fin.append(min_)
for i in fin:
	print(i)


import math
q = input()
cc = []
for j in range(eval(q)):
	mm = input()
	ee = mm.split(' ')
	ll = []
	for i in range(len(ee)):
		ll.append(eval(ee[i]))
	cc.append(ll)
for ll in cc:
	w = 0
	sum = 0
	if ll[0] is ll[1]:
		if ll[2] > ll[0]:
			w = ll[0]
		else:
			for i in ll:
				sum += i
			w = sum / 3
	elif ll[0] is 0 or ll[1] is 0:
		w = 0
	else:
		if ll[0] < ll[1]:
			h = ll[1] - ll[0] + ll[2]
			if h > ll[0]:
				w = ll[0]
			else:
				w = h
		else:
			h = ll[0] - ll[1] + ll[2]
			if h > ll[1]:
				w = ll[1]
			else:
				w = h
		if h < ll[0] and h < ll[1]:
			for i in ll:
				sum += i
			w = sum / 3
	if w < 0:
		print(math.floor(min(ll[0], ll[1])))
	else:
		print(math.floor(w))


import sys
r = lambda : sys.stdin.readline().rstrip()
T = int(r())
while T:
	(c, m, x) = list(map(int, r().split()))
	ans = 0
	mn = min(c, m, x)
	ans += mn
	c -= mn
	m -= mn
	x -= mn
	while c != 0 and m != 0 and (c + m >= 3):
		if c > m:
			mn = min(m, c - m)
			c -= 2 * mn
			m -= mn
			ans += mn
		elif m > c:
			mn = min(c, m - c)
			c -= mn
			m -= 2 * mn
			ans += mn
		else:
			mn = m // 3
			c %= 3
			m %= 3
			ans += 2 * mn
			if c == 2 and m == 2:
				ans += 1
				break
	print(ans)
	T -= 1


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	ans = 0
	mini = min(c, m, x)
	if mini != x:
		ans += mini
	else:
		c -= x
		m -= x
		ans += x
		mini = min(c, m)
		maxi = max(c, m)
		if maxi >= 2 * mini:
			ans += mini
		else:
			ans += (c + m) // 3
	print(ans)


T = int(input())
while T > 0:
	(c, m, x) = map(int, input().split())
	x += max(c, m) - min(c, m)
	(c, m) = (min(c, m), min(c, m))
	ans = min(c, m, x)
	c -= ans
	m -= ans
	x -= ans
	ans += (c + m) // 3
	print(ans)
	T -= 1


q = int(input())
while q:
	q -= 1
	a = [int(i) for i in input().split()]
	m = min(a[0], a[1])
	s = sum(a)
	s = s // 3
	print(min(m, s))


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
	elif c - x >= 0 and m - x >= 0:
		p = c - x
		q = m - x
		if abs(p - q) <= min(p, q):
			print((p + q) // 3 + x)
		else:
			print(min(p, q) + x)
	else:
		print(min(c, m))


import os
import sys
from io import BytesIO, IOBase
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')
q = int(input())
while q > 0:
	(c, m, x) = [int(a) for a in input().split()]
	st = 0
	en = min(c, m)
	res = 0
	while st <= en:
		mid = int((st + en) / 2)
		if 3 * mid <= c + m + x:
			res = mid
			st = mid + 1
		else:
			en = mid - 1
	print(res)
	q -= 1


import sys

def main():
	q = int(sys.stdin.readline())
	for _ in range(q):
		(c, m, x) = map(int, sys.stdin.readline().split())
		mn = min(c, m)
		t = c + m + x
		if t >= mn * 3:
			print(mn)
		else:
			print(t // 3)
main()


num_queries = int(input())
for _ in range(num_queries):
	inputs = tuple(map(int, input().split()))
	print(min(inputs[0], inputs[1], sum(inputs) // 3))


def teams(c, m):
	if c == 2 and m == 2:
		return 1
	elif c == 2 and m == 1:
		return 1
	elif c == 1 and m == 2:
		return 1
	elif c == 2 and m == 0:
		return 0
	elif c == 0 and m == 2:
		return 0
	elif c == 0 and m == 1:
		return 0
	elif c == 1 and m == 0:
		return 0
	elif m == 1 and c == 1:
		return 0
	elif m == 0 and c == 0:
		return 0
	if c > m:
		d = c - m
		if d == 1:
			c -= 2
			m -= 1
			return 1 + teams(c, m)
		else:
			c -= d // 2 * 2
			m -= d // 2
			return d // 2 + teams(c, m)
	elif m > c:
		d = c - m
		if d == 1:
			c -= 1
			m -= 2
			return 1 + teams(c, m)
		else:
			c -= d // 2 * 2
			m -= d // 2
			return d // 2 + teams(c, m)
	elif c == m:
		c1 = c
		c = c % 3
		m = m % 3
		return c1 // 3 * 2 + teams(c, m)
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	m1 = min(c, m)
	if x >= m1:
		print(m1)
	else:
		team = x
		c -= x
		m -= x
		if c >= m * 2:
			team += m
		elif m >= c * 2:
			team += c
		else:
			team += teams(m, c)
		print(team)


import sys, os, re, datetime, copy
from collections import *
from bisect import *
from math import *

def mat(v, *dims):

	def dim(i):
		return [copy.copy(v) for _ in range(dims[-1])] if i == len(dims) - 1 else [dim(i + 1) for _ in range(dims[i])]
	return dim(0)
__cin__ = None

def cin():
	global __cin__
	if __cin__ is None:
		__cin__ = iter(input().split(' '))
	try:
		return next(__cin__)
	except StopIteration:
		__cin__ = iter(input().split(' '))
		return next(__cin__)

def iarr(T, n):
	return [T(cin()) for _ in range(n)]

def carr(n):
	return input()

def imat(T, n, m):
	return [iarr(T, m) for _ in range(n)]

def cmat(n, m):
	return [input() for _ in range(n)]

def solve():
	c = int(cin())
	m = int(cin())
	x = int(cin())
	x += abs(c - m)
	m = min(c, m)
	if x >= m:
		print(m)
		return
	(lo, hi) = (x, m)
	best = 0
	while lo <= hi:
		mi = lo + hi >> 1
		incs = (mi - x + 1) // 2
		if m - incs < mi:
			hi = mi - 1
		else:
			best = max(best, mi)
			lo = mi + 1
	print(best)
q = int(cin())
for i in range(q):
	solve()


q = int(input())
while q:
	(c, m, x) = input().split()
	(c, m, x) = [int(c), int(m), int(x)]
	sum = c + m + x
	avg = int(sum / 3)
	if c > m:
		cm = m
	else:
		cm = c
	if cm >= avg:
		print(avg)
	else:
		print(cm)
	q -= 1


q = int(input())
for i in range(q):
	(c, m, x) = [int(v) for v in input().split(' ')]
	print(min(min(c, m), sum([c, m, x]) // 3))


t = int(input())
while t > 0:
	(c, m, k) = map(int, input().split())
	if c == 0 or m == 0:
		print(0)
	elif k < m and k < c:
		c -= k
		m -= k
		if (c + m) // 3 > min(c, m):
			print(k + min(c, m))
		else:
			print(k + (c + m) // 3)
	else:
		print(min(m, c))
	t -= 1


nCases = int(input())
for _ in range(nCases):
	students = [int(x) for x in input().split()]
	teams = 0
	low = min(students)
	students = [x - low for x in students]
	teams += low
	if students[2] == 0:
		low = min(students[0:2])
		high = max(students)
		students[2] = high - low
		low = min(students)
		students = [x - low for x in students]
		teams += low
	if students[2] == 0:
		left = min(students[0:2]) * 2
		teams += int(left / 3)
	print(teams)


from sys import stdin
q = int(stdin.readline().strip())
for i in range(q):
	(c, m, x) = list(map(int, stdin.readline().strip().split()))
	n = c + m + x
	y = min(c, m)
	t = n // 3
	ans = min(y, t)
	print(ans)


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
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(c, m, x) = ria()
		ma = max(m, x, c)
		mi = min(m, x, c)
		me = c + m + x - ma - mi
		if mi == c or mi == m:
			ans = mi
		else:
			z = ma - me
			if mi + z >= me:
				ans = me
			else:
				ma -= z
				mi += z
				y = (ma - mi) / 3
				mi += 2 * y
				ans = int(mi)
		print(ans)
	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()


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	ans = min(c, m)
	n = c + m + x - ans * 3
	if n < 0:
		ans -= abs(n) // 3 + 1
		if abs(n) % 3 == 0:
			ans += 1
	print(ans)


q = input()
t = []
for i in range(int(q)):
	t.append([int(x) for x in input().split()])

def pfct(c, m, x):
	global count
	if c * m * x > 0:
		p = min(c, m, x)
		count += p
		return pfct(c - p, m - p, x - p)
	elif c * m == 0:
		return count
	elif x == 0:
		if c < m:
			return pfct(m, c, x)
		if c // 2 >= m:
			count += m
			return count
		else:
			a = c - m
			count += a + (c + m - 3 * a) // 3
			return count
for i in t:
	count = 0
	print(pfct(*i))


from math import ceil, floor, log10, log2

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())
q = ii()
for i in range(q):
	(c, m, x) = lmii()
	print(min((c + m + x) // 3, min(c, m)))


t = int(input())
for i in range(t):
	(c, m, x) = map(int, input().split())
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	otv = min(c, m, x)
	c -= otv
	m -= otv
	x -= otv
	otv += (c + m) // 3
	print(otv)


def valid(x, y, z, ans):
	x = x - ans
	y = y - ans
	if x < 0 or y < 0:
		return False
	t = x + y + z
	if t >= ans:
		return True
	return False

def find(x, y, z):
	left = 1
	right = max(x, y, z)
	ans = 0
	while left <= right:
		mid = left + (right - left) // 2
		if valid(x, y, z, mid):
			ans = max(ans, mid)
			left = mid + 1
		else:
			right = mid - 1
	return ans
for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(find(x, y, z))


n = int(input())
for _ in range(n):
	(c, m, x) = map(int, input().split())
	s = c + m + x
	p = min((s // 3, c, m))
	print(p)


a = int(input())
for i in range(a):
	(k, l, m) = map(int, input().split())
	print(min([(k + l + m) // 3, min([k, l])]))


n = int(input())
for _ in range(n):
	(c, m, x) = [int(p) for p in input().split()]
	count = 0
	d = min(c, m)
	x += c - d
	x += m - d
	c = m = d
	count += min(m, x)
	c -= min(c, x)
	m -= min(m, x)
	count += (c + m) // 3
	print(count)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c > m:
		(c, m) = (m, c)
	if c <= x:
		print(c)
	else:
		c -= x
		m -= x
		if c * 2 <= m:
			print(x + c)
		else:
			print((c + m) // 3 + x)


q = int(input())
info = [[int(i) for i in input().split()] for k in range(q)]
for inf in info:
	(c, m, x) = inf
	print(min([c, m, int((c + m + x) / 3)]))


def solver(st):
	mn = min(st[0], st[1])
	mx = max(st[0], st[1])
	(st[0], st[1]) = (mn, mn)
	st[2] = mx - mn + st[2]
	if st[2] > mn:
		return mn
	else:
		return (2 * mn + st[2]) // 3
q = int(input())
for i in range(q):
	x = input()
	xn = [int(k) for k in x.split()]
	print(solver(xn))


test = int(input())
for i in range(test):
	(a, b, c) = map(int, input().split())
	ans = min(a, b, (a + b + c) / 3)
	print(int(ans))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
from collections import *
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def function(arr, size, dp):
	if size == 1 or size == 0:
		return 1
	key = ''.join(map(str, arr[:size]))
	if dp[key]:
		return dp[key]
	output = function(arr, size - 1, dp)
	key = ''.join(map(str, arr[:size - 1]))
	dp[key] = output
	if arr[size - 2] * 10 + arr[size - 1] <= 26:
		output += function(arr, size - 2, dp)
		key = ''.join(map(str, arr[:size - 2]))
		dp[key] = output
	return output

def main():
	for _ in range(ii()):
		(c, m, x) = mi()
		if max(c, m) <= x:
			print(min(c, m))
		elif x < min(c, m):
			c -= x
			m -= x
			if 2 * min(c, m) < max(c, m):
				print(x + min(c, m))
			else:
				print(x + (c + m) // 3)
		else:
			print(min(c, m))
main()


q = int(input())
for _ in range(q):
	(n, m, k) = map(int, input().split())
	if n + m + k > 3 * min(n, m):
		print(min(m, n))
	else:
		print((n + m + k) // 3)


t = int(input())
while t:
	t -= 1
	(n, m, k) = map(int, input().split())
	min1 = min(n, m)
	sum = n + m + k
	if min1 <= sum / 3:
		print(min1)
	else:
		print(sum // 3)


stdin = lambda type_='int', sep=' ': list(map(eval(type_), input().split(sep)))

def can(c, m, x, mid):
	if c < mid or m < mid:
		return False
	c -= mid
	m -= mid
	return c + m + x >= mid
for _ in range(int(input())):
	(c, m, x) = stdin()
	l = 0
	r = max(c, m, x)
	while l <= r:
		mid = l + (r - l) // 2
		if can(c, m, x, mid):
			l = mid + 1
		else:
			r = mid - 1
	print(l - 1)


def solution(a, b, c):
	result = min(a, min(b, c))
	a = a - result
	b = b - result
	c = c - result
	if a == 0 or b == 0:
		return result
	else:
		result2 = (a + b) // 3
		result = result + min(min(a, b), result2)
	return result
q = int(input())
while q != 0:
	a = list(map(int, input().split()))
	print(solution(a[0], a[1], a[2]))
	q = q - 1


for t in range(int(input())):
	(c, m, x) = map(int, input().split())
	max_poss = min(c, m, x)
	c -= max_poss
	m -= max_poss
	x -= max_poss
	minim_c_m = min(c, m)
	more = (c + m) // 3
	max_poss += min(minim_c_m, more)
	print(max_poss)


from sys import stdin
t = int(input())
while t > 0:
	count = 0
	(a, b, c) = [int(i) for i in stdin.readline().split()]
	print(min((a + b + c) // 3, min(a, b)))
	t -= 1


T = int(input())
for _ in range(T):
	(a, b, c) = list(map(int, input().split()))
	team = min(a, b)
	team = min(team, (a + b + c) // 3)
	remain = a + b + c - team * 2
	ans = min(team, remain)
	print(ans)


q = int(input())
for i in range(q):
	a = list(map(int, input().split()))
	summ = sum(a)
	del a[2]
	if summ // 3 > min(a):
		print(min(a))
	else:
		print(summ // 3)


q = int(input())
for i in range(q):
	m = list(map(int, input().split()))
	if m[0] <= m[1]:
		if 2 * m[0] <= m[1] + m[2]:
			print(m[0])
		else:
			print(int((m[0] + m[1] + m[2]) / 3))
	elif 2 * m[1] <= m[0] + m[2]:
		print(m[1])
	else:
		print(int((m[0] + m[2] + m[1]) / 3))


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

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

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (digits - len(b)) + b
	return b

def is_prime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def generate_primes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
factorial_modP = []

def warm_up_fac(MOD):
	global factorial_modP, fac_warm_up
	if fac_warm_up:
		return
	factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
	for i in range(2, fac_warm_up_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warm_up = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	global fac_warm_up, factorial_modP
	if not fac_warm_up:
		warm_up_fac(MOD)
		fac_warm_up = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def test_print(*args):
	if testingMode:
		print(args)

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

def display_2D_list(li):
	for i in li:
		print(i)

def prefix_sum(li):
	sm = 0
	res = []
	for i in li:
		sm += i
		res.append(sm)
	return res

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

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 ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = True
fac_warm_up_size = 10 ** 5 + 100
optimise_for_recursion = False

def main():
	(c, m, x) = get_tuple()
	j = min(m, c)
	if j <= m + c - 2 * j + x:
		print(min(m, c))
	else:
		print(min(m, c, (m + x + c) // 3))
if TestCases:
	for i in range(get_int()):
		main()
else:
	main() if not optimise_for_recursion else threading.Thread(target=main).start()


for _ in range(int(input())):
	(c, m, s) = [int(i) for i in input().split()]
	(a, b) = (min(c, m), max(c, m))
	if s >= a:
		print(a)
	else:
		a = a - s
		b = b - s
		temp = (a + b) // 3
		print(s + min(temp, a))


q = int(input())
for i in range(0, q):
	(c, m, x) = map(int, input().split(' '))
	ans = min(min(c, m), (c + m + x) // 3)
	print(ans)


t = int(input())
for _ in range(0, t):
	(c, m, n) = list(map(int, input().split()))
	m1 = min(c, m, n)
	if m1 == c or m1 == m:
		print(m1)
	else:
		print(min(min(c, m), (c + m + n) // 3))


c = 0
m = 0
x = 0

def judge(s):
	if s > c or s > m:
		return False
	elif x + c + m < 3 * s:
		return False
	return True
q = int(input().strip())
for case in range(q):
	(c, m, x) = map(int, input().strip().split())
	lb = 0
	rb = min([c, m])
	mid = (lb + rb) // 2
	ans = 0
	while lb <= rb:
		mid = (lb + rb) // 2
		if not judge(mid):
			rb = mid - 1
		else:
			ans = mid
			lb = mid + 1
	print(ans)


t = int(input())
for T in range(t):
	(c, m, x) = [int(x) for x in input().split()]
	(mn, mx) = (min(c, m), max(c, m))
	diff = mx - mn
	x += diff
	if c > m:
		c -= diff
	else:
		m -= diff
	tp1 = min(c, m, x)
	(c, m, x) = (c - tp1, m - tp1, x - tp1)
	tp1 += (c + m) // 3
	print(tp1)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	s = min(c, m)
	k = c + m + x
	if s == 0 or k // s >= 3:
		print(s)
	else:
		print(k // 3)


q = int(input())

def solve(a, b):
	if a == b:
		return (a + b) // 3
	if a * 2 <= b:
		return a
	diff = abs(a - b)
	a -= diff
	return diff + 2 * a // 3
for _ in range(q):
	(c, m, x) = [int(i) for i in input().split(' ')]
	mn = min(c, m, x)
	c -= mn
	m -= mn
	x -= mn
	if not c or not m:
		print(mn)
	else:
		print(mn + solve(min(c, m), max(c, m)))


t = int(input())
while t:
	t = t - 1
	(c, m, x) = [int(x) for x in input().split(' ')]
	y = min(c, m)
	c = c - y
	m = m - y
	if y <= c + m + x:
		print(y)
	else:
		print((c + m + x + y * 2) // 3)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(a, b, c) = mp()
	print(min(a, b, (a + b + c) // 3))


import sys
import math
from collections import defaultdict
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
t = int(input())
while t != 0:
	t -= 1
	(c, m, ns) = [int(x) for x in input().split()]
	only_c_m = min(c, m)
	ans = min(only_c_m, (c + m + ns) / 3)
	print(int(ans))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	x = min(a, b)
	s = a - x + b - x + c
	if s >= x:
		print(x)
	else:
		print(s + 2 * (x - s) // 3)


n = int(input())
for k in range(n):
	(c, m, o) = map(int, input().split())
	print(min(c, m, (c + m + o) // 3))


t = int(input())
a = []
for i in range(t):
	b = list(map(int, input().split()))
	a.append(b)
for i in a:
	c = i[0]
	m = i[1]
	p = i[2]
	s = sum(i) // 3
	d = min(c, m)
	if s >= d:
		print(d)
	else:
		print(s)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	a = 0
	mi = min(c, m, x)
	a += mi
	c -= mi
	m -= mi
	x -= mi
	s = c + m + x
	if x == 0:
		a += min(m, c, (m + c) // 3)
	print(a)


n = int(input())
while n > 0:
	l = list(map(int, input().split()))
	print(min(min(l[0], l[1]), int((l[0] + l[1] + l[2]) / 3)))
	n -= 1


T = int(input())
for j in range(T):
	(C, M, S) = map(int, input().split())
	res = 0
	if C <= M:
		M -= C
		res = C
		C = 0
		res = min(res, (2 * res + M + S) // 3)
	else:
		C -= M
		res = M
		M = 0
		res = min(res, (2 * res + C + S) // 3)
	print(res)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	(c, m, x) = rinput()
	a = (c + m + x) // 3
	print(min(a, c, m))


from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
for _ in range(read_int()):
	(c, m, x) = read_int_array()
	y = min(c, m)
	print(min(y, (c + m + x) // 3))


import math
queries = int(input())
for _ in range(queries):
	(r1, r2, neit) = map(int, input().split())
	limiting = min(r1, r2)
	nonlimiting = max(r1, r2)
	excess = nonlimiting - limiting
	nonlimiting -= excess
	neit += excess
	if neit >= limiting:
		print(limiting)
	else:
		ideal_middle = math.floor(sum([limiting, nonlimiting, neit]) / 3)
		print(ideal_middle)


q = int(input())
for g in range(q):
	(c, m, x) = [int(x) for x in input().split()]
	z = min(m, c, (m + c + x) // 3)
	print(z)


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	(a, b, c) = num_input()
	print(min(a, b, (a + b + c) // 3))
t = int(input())
for _ in range(t):
	solve()


q = int(input())
while q:
	q += -1
	(n, m, x) = [int(x) for x in input().split()]
	print(min(n, m, (n + m + x) // 3))


numbers = int(input())
for i in range(numbers):
	entrada = input().split(' ')
	soma = int(entrada[0]) + int(entrada[1]) + int(entrada[2])
	number_group = soma // 3
	if int(entrada[0]) >= number_group and int(entrada[1]) >= number_group:
		print(int(number_group))
	elif int(entrada[0]) >= int(entrada[1]):
		print(int(entrada[1]))
	else:
		print(int(entrada[0]))


T = int(input())
for run in range(T):
	(c, m, x) = map(int, input().strip().split(' '))
	print(min(c, m, (c + m + x) // 3))


q = int(input())
while q != 0:
	q -= 1
	(c, m, x) = input().split()
	(c, m, x) = (int(c), int(m), int(x))
	mini = min((c + m + x) // 3, min(c, m))
	print(mini)


q = int(input())
for i in range(q):
	k = 0
	(c, m, x) = [int(s) for s in input().split()]
	if min(c, m, x) != x:
		print(min(c, m))
	else:
		k += x
		z = (c + m - 2 * x) // 3
		print(k + min(z, c - x, m - x))


t = int(input())
for i in range(t):
	(c, m, n) = map(int, input().split())
	print(min(c, m, (c + m + n) // 3))


t = int(input())
for i in range(t):
	(c, m, x) = list(map(int, input().split()))
	d = min(c, m)
	print(min(d, (c + m + x) // 3))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		a = LI()
		r = min(sum(a) // 3, min(a[:2]))
		rr.append(r)
	return JA(rr, '\n')
print(main())


cases = input()
for i in range(int(cases)):
	opc = input().split()
	c = int(opc[0])
	m = int(opc[1])
	x = int(opc[2])
	res = min(c, m)
	res = min(res, (c + m + x) / 3)
	print(int(res))


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	n = min([c, m, x])
	c -= n
	m -= n
	x -= n
	if c == 0 or m == 0:
		print(n)
	else:
		if c > m:
			(c, m) = (m, c)
		if c <= m // 2:
			k = c
		else:
			k = (c + m) // 3
		print(n + k)


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right
import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	x = abs(a - b)
	c += x
	if a > b:
		a -= x
	else:
		b -= x
	y = min(a, min(b, c))
	a -= y
	b -= y
	c -= y
	print(y + (a + b) // 3)


def solve(c, m, x):
	return min(c, m, (c + m + x) // 3)
n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	print(solve(c, m, x))


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	m = min(a, b, c)
	a -= m
	b -= m
	(a, b) = (min(a, b), max(a, b))
	tmp1 = min(b - a, a)
	a -= tmp1
	b -= 2 * tmp1
	tmp2 = 2 * (a // 3)
	if a % 3 == 2:
		print(m + tmp1 + tmp2 + 1)
	else:
		print(m + tmp1 + tmp2)


def ideal(x, y, z):
	return min(x, y, (x + y + z) // 3)
q = int(input())
for i in range(q):
	(c, m, x) = [int(j) for j in input().split()]
	print(ideal(c, m, x))


def tim(c, m, x):
	s = c + m + x
	kq = 0
	if s < 3:
		return 0
	if s == 3:
		if c == 0 or m == 0:
			return 0
		else:
			return 1
	if c == 0 or m == 0:
		return 0
	mn = min(c, m)
	t = s // 3
	kq = min(mn, t)
	return kq
q = int(input())
for i in range(q):
	(a, b, c) = map(int, input().split())
	kq = tim(a, b, c)
	print(kq)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	dif = max(c, m) - min(c, m)
	if c > m:
		c -= dif
	else:
		m -= dif
	x += dif
	total = min(c, m, x)
	c -= total
	m -= total
	total += int(c + m) // 3
	print(total)


Q = int(input())
for q in range(Q):
	(c, m, x) = tuple(map(int, input().split()))
	ans = min(c, m)
	c -= ans
	m -= ans
	if c + m + x >= ans:
		print(ans)
		continue
	delta = (ans - (c + m + x)) * 2
	ans = c + m + x
	ans += min(delta // 3, delta // 2)
	print(ans)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(c, m, x) = zz()
	mi = min(c, m)
	mx = max(c, m)
	p = x + mx - mi
	print(min(mi, (mx + x + mi) // 3))


q = int(input())
l = []
for i in range(q):
	l.append([int(j) for j in input().split()])
for i in l:
	print(min(i[0], i[1], sum(i) // 3))


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	mx = max(c, m)
	mn = min(c, m)
	if x >= mn:
		res = mn
	else:
		res = x
		mn -= x
		mx -= x
		df = mx - mn
		if df >= mn:
			res += mn
		else:
			res += df
			mn -= df
			res += mn // 3 * 2
			if mn % 3 == 2:
				res += 1
	print(res)


q = int(input())
for i in range(0, q):
	s = input().split()
	c = int(s[0])
	m = int(s[1])
	x = int(s[2])
	su = c + m + x
	avg = int(su / 3)
	if c >= avg and m >= avg:
		print(avg)
	elif c <= m:
		print(c)
	elif m <= c:
		print(m)


q = int(input())
for i in range(q):
	(a, b, c) = list(map(int, input().split()))
	ans = min(a, b, c)
	a -= c
	b -= c
	if a >= 0 and b >= 0:
		c = max(a, b) - min(a, b)
		ans += min(min(a, b), c)
		a = min(a, b) - c
		b = a
		if a >= 0 and b >= 0:
			ans += a // 3 * 2
			a = a % 3
			b = b % 3
			if a >= 2 and b >= 2:
				ans += 1
	print(ans)


from math import ceil

def INPUT():
	return [int(x) for x in input().split(' ')]

def main():
	q = int(input())
	while q > 0:
		ans = 0
		(c, m, x) = INPUT()
		CandM = c
		if c != m:
			dif = abs(c - m)
			CandM = min(c, m)
			x += dif
		mn = min(x, CandM)
		ans += mn
		CandM -= mn
		ans += 2 * CandM // 3
		print(ans)
		q -= 1
main()


for x in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = min(a, b)
	print(min((a + b + c) // 3, d))


def solve(c, m, x, ans):
	y = min(c, m, x)
	curr = y
	c -= y
	m -= y
	x -= y
	if c == 0 or m == 0:
		ans.append(curr)
		return
	(x, y) = (min(c, m), max(c, m))
	if y >= 2 * x:
		curr += x
	else:
		curr += (x + y) // 3
	ans.append(curr)

def main():
	ans = []
	q = int(input())
	for i in range(q):
		(c, m, x) = map(int, input().split())
		solve(c, m, x, ans)
	for i in ans:
		print(i)
main()


from math import *
t = int(input())
for y in range(t):
	(c, m, n) = map(int, input().split())
	x = min(c, m, (c + m + n) // 3)
	print(x)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	if min(c, m) == 0 or c + m + x <= 2:
		print(0)
	elif min(c, m) > x:
		if max(c - x, m - x) >= 2 * min(c - x, m - x):
			print(x + min(c - x, m - x))
		else:
			print(x + (c - x + (m - x)) // 3)
	else:
		print(min(c, m))


def gns():
	return list(map(int, input().split()))
t = int(input())

def check(a, b, c, n):
	if a < n or b < n:
		return False
	a -= n
	b -= n
	x = a + b + c
	if x < n:
		return False
	return True

def bi(a, b, c):
	(l, r) = (0, a + b + c)
	while r - l > 1:
		m = (r + l) // 2
		if check(a, b, c, m):
			l = m
		else:
			r = m
	return l
for i in range(t):
	(a, b, c) = gns()
	print(bi(a, b, c))


import math
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	print(min(c, m, (c + m + x) // 3))


import sys
input = sys.stdin.readline
q = int(input())
for i in range(q):
	(c, m, x) = [int(item) for item in input().split()]
	ans = min(min(c, m), (c + m + x) // 3)
	print(ans)


def perfect_team(a, b, c):
	return (min(a, b) + min(min(a, b) * 2, max(a, b) + c)) // 3
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(perfect_team(a, b, c))


t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	if c == 0 or m == 0:
		print('0')
	else:
		co = min(c, m, x)
		(c, m, x) = (c - co, m - co, x - co)
		if c == 0 or m == 0:
			print(co)
		else:
			d1 = max(c, m)
			d2 = min(c, m)
			if d2 * 2 <= d1:
				co += d2
			else:
				co += (d1 + d2) // 3
			print(co)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	(c, m, x) = inm()
	print(min(c, m, (c + m + x) // 3))


outputs = []
for __ in range(int(input())):
	(c, m, x) = list(map(int, input().split()))
	r = min(c, m)
	if max(c, m) - min(c, m) + x >= r:
		outputs.append(r)
	else:
		l = 0
		mid = (l + r) // 2
		while l <= r:
			if mid * 3 <= c + m + x and (mid == r or (mid + 1) * 3 > c + m + x):
				outputs.append(mid)
				break
			elif mid * 3 > c + m + x:
				if mid == 0:
					outputs.append(0)
					break
				else:
					r = mid - 1
					mid = (l + r) // 2
			elif mid == r:
				outputs.append(r)
				break
			else:
				l = mid + 1
				mid = (l + r) // 2
for o in outputs:
	print(o)


for i in range(int(input())):
	(c, m, x) = [int(x) for x in input().split()]
	k = min(c, m)
	t = max(c, m)
	v = t - k
	if x >= k or t - x - 2 * v < 0:
		print(k)
	else:
		p = k - v - x
		print(2 * p // 3 + x + v)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if x == min(c, m, x):
		c1 = c - x
		m1 = m - x
		i = min(min(c1, m1), max(c1, m1) // 2)
		print(x + min(c1, m1, (c1 + m1) // 3))
	else:
		print(min(c, m))


import sys
MOD = pow(10, 9) + 7

def IN(f=0):
	if f == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
tc = IN(1)
for _ in range(tc):
	(m, c, x) = IN()
	g = min(m, c)
	m -= g
	c -= g
	f = 0
	if g <= m + c + x:
		print(g)
	else:
		k = min(x, g)
		f = k
		g -= k
		for UU in range(0):
			FF = 1
		if m == 0:
			f += min((c + g * 2) // 3, g)
		else:
			f += min((m + g * 2) // 3, g)
		print(f)


def main():
	import sys
	input = sys.stdin.readline
	q = int(input())
	for _ in range(q):
		(c, m, x) = map(int, input().split())
		print(min(c, m, (c + m + x) // 3))
main()


q = int(input())
for _ in range(q):
	(c, m, x) = [int(x) for x in input().split()]
	dec = min(c, m, x)
	c -= dec
	m -= dec
	x -= dec
	if c < m:
		(c, m) = (m, c)
	dec2 = min(m, c - m)
	c -= dec2 * 2
	m -= dec2
	ans = dec + dec2
	if m > 0 and c > 1:
		dec3 = c // 3
		ans += dec3 * 2
		if c - dec3 * 3 == 2:
			ans += 1
	print(ans)


for _ in range(int(input())):
	(c, m, s) = map(int, input().split())
	su = c + m + s
	su = su // 3
	if min(c, m) > su:
		print(su)
	else:
		print(min(c, m))


from math import floor

def main():
	t = int(input())
	for __ in range(t):
		(c, m, x) = map(int, input().split())
		if c > m:
			(m, c) = (c, m)
		x += m - c
		m = c
		ans = min(x, c)
		if c - ans > 0:
			c -= ans
			m -= ans
			ans += floor((m + c) / 3)
		print(ans)
main()


n = int(input())
for i in range(n):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	small = min(a, b)
	ans = 0
	n1 = (a + b + c) // 3
	if n1 < small:
		ans = n1
	else:
		ans = small
	print(ans)


import sys
input = sys.stdin.readline
from math import *

def bs(i, c, m, x):
	if i == 0:
		return True
	return min(m // i, c // i) > 0
t = int(input())
while t > 0:
	t -= 1
	(c, m, x) = map(int, input().split())
	s = 0
	e = c + m + x
	ans = 0
	while s <= e:
		mid = (s + e) // 2
		if bs(mid // 3, c, m, x):
			ans = mid // 3
			s = mid + 1
		else:
			e = mid - 1
	print(ans)


Q = int(input())
for q in range(Q):
	s = [int(x) for x in input().split()]
	m = 0
	if s[1] < s[0]:
		m = 1
	others = 0
	if m == 0:
		others = s[1] + s[2]
	else:
		others = s[0] + s[2]
	while True:
		div = int(others / 2)
		if div >= s[m]:
			print(s[m])
			break
		else:
			sub = int((s[m] - div) / 2)
			if sub == 0:
				sub += 1
			s[m] -= sub
			others += sub


t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	mini = min(x, y)
	maxi = max(x, y)
	x = mini
	y = mini
	z += maxi - mini
	if z >= x:
		print(x)
	else:
		print((x + y + z) // 3)


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans
q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	d = min(c, m)
	tc = c + m + x
	print(min(d, tc // 3))


from sys import stdin
l = stdin.read().splitlines()[1:]
for (i, s) in enumerate(l):
	(c, m, x) = map(int, s.split())
	l[i] = min(c, m, (c + m + x) // 3)
print('\n'.join(map(str, l)))


n = int(input())
for _ in range(n):
	(coder, matematic, other) = map(int, input().split())
	chute_inicial = min(coder, matematic, other)
	coder -= chute_inicial
	matematic -= chute_inicial
	other -= chute_inicial
	if other == 0:
		print(chute_inicial + min((coder + matematic) // 3, min(coder, matematic)))
	else:
		print(chute_inicial)


from sys import stdin
from sys import setrecursionlimit as SRL
SRL(10 ** 7)
rd = stdin.readline
rrd = lambda : map(int, rd().strip().split())
T = int(input())
while T:
	(n, m, c) = rrd()
	ans = 0
	g = min(c, min(n, m))
	ans += g
	n -= g
	m -= g
	(l, r) = (0, max(n, m))
	while l < r:
		md = (l + r) // 2
		if min(n, m) >= md and n + m - 2 * md >= md:
			l = md + 1
		else:
			r = md
	ans += max(0, l - 1)
	print(ans)
	T -= 1


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	t = a + b + c
	ma = t // 3
	m = min(a, b)
	if t >= m * 3:
		print(m)
	else:
		print(ma)


import math

def init():
	q = int(input())
	for i in range(q):
		(c, m, x) = map(lambda x: int(x), input().split(' '))
		min_s = min(c, m)
		extra = math.floor((x + c + m) / 3)
		print(min(min_s, extra))
init()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	(l, r) = (0, (a + b + c) // 3)
	while l <= r:
		mid = (l + r) // 2
		if min(a, b) < mid:
			r = mid - 1
		elif a + b - 2 * mid < mid - c:
			r = mid - 1
		elif a + b - 2 * mid >= mid - c:
			l = mid + 1
	print(r)


import sys
input = sys.stdin.readline
t = 1
t = int(input())
for _ in range(t):
	(c, m, x) = [int(x) for x in input().split()]
	print(min(c, m, (c + m + x) // 3))


test = int(input())
while test > 0:
	test -= 1
	count = 0
	(a, b, c) = map(int, input().split())
	d = (a + b + c) // 3
	print(min(a, b, d))


teams = [list(map(int, input().split())) for i in range(int(input()))]
for team in teams:
	counter = 0
	if team[0] > team[1]:
		(team[0], team[1]) = (team[1], team[0])
	t = team[1] - team[0]
	team[1] -= t
	team[2] += t
	if team[2] < team[0]:
		counter += team[2]
		team[0] -= team[2]
		team[1] -= team[2]
		team[2] = 0
		counter += (team[0] + team[1]) // 3
	else:
		counter = team[0]
	print(counter)


import os
import sys
from io import BytesIO, IOBase

def solution(c, m, x):
	if c == 0 or m == 0 or sum([c, m, x]) < 3:
		write(0)
		return
	(c, m) = sorted([c, m])
	diff = m - c
	m -= diff
	x += diff
	min_val = min([c, m, x])
	c -= min_val
	m -= min_val
	x -= min_val
	min_val += (c + m) // 3
	write(min_val)

def main():
	for _ in range(r_int()):
		(c, m, x) = r_array()
		solution(c, m, x)
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


queries = int(input())
for x in range(queries):
	nums = (int(x) for x in input().split())
	(code, math, no) = nums
	result = (code + math + no) // 3
	result = min(code, result)
	result = min(math, result)
	print(result)


q = int(input())
for i in range(q):
	foo = 0
	(c, m, x) = map(int, input().split())
	mn = max(c, m) - min(c, m)
	x += mn
	if c > m:
		c -= mn
	else:
		m -= mn
	foo += min(c, m, x)
	c -= foo
	m -= foo
	foo += (c + m) // 3
	print(foo)


q = int(input())

def solve(c, m, x):
	total = sum([c, m, x])
	min_num = min([c, m, total // 3])
	can_be = min_num
	c -= min_num
	m -= min_num
	x += c + m
	return min(can_be, x)
for _ in range(q):
	(c, m, x) = [int(x) for x in input().split(' ')]
	print(solve(c, m, x))


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def possible(x):
	left = a - x + (b - x) + c
	return left >= x
for _ in range(Int()):
	(a, b, c) = value()
	low = 0
	high = min(a, b)
	while low <= high:
		mid = (low + high) // 2
		if possible(mid):
			ans = mid
			low = mid + 1
		else:
			high = mid - 1
	print(ans)


import math
import sys
n = int(input())
for i in range(n):
	(c, m, x) = (int(_) for _ in input().split())
	print(int(min(min(c, m), sum([c, m, x]) / 3)))


class Node:

	def __init__(self, key):
		self.data = key
		self.left = None
		self.right = None

def insert(node, data):
	if node is None:
		return Node(data)
	else:
		if data <= node.data:
			node.left = insert(node.left, data)
		else:
			node.right = insert(node.right, data)
		return node

def minValue(node):
	current = node
	while current.left is not None:
		current = current.left
	return current.data
for _ in range(int(input())):
	root = None
	(a, b, c) = map(int, input().split())
	root = insert(root, a)
	insert(root, b)
	minab = minValue(root)
	print(min(minab, (a + b + c) // 3))


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	lim = (c + m + x) // 3
	print(min(c, m, lim))


q = int(input())
for tmp in range(q):
	(c, m, x) = list(map(int, input().split()))
	x += abs(c - m)
	(c, m) = (min(c, m), min(c, m))
	if c <= x:
		print(c)
	else:
		print(x + 2 * (c - x) // 3)


import sys
n = int(sys.stdin.readline())
for _ in range(n):
	(c, m, x) = map(int, sys.stdin.readline().split())
	print(min(c, m, (c + m + x) // 3))


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	if m != c:
		d = abs(m - c)
		m = min(m, c)
		c = min(m, c)
		x += d
	ans = min(c, min(m, x))
	c -= ans
	m -= ans
	x -= ans
	t = min(m, c) // 3
	ans += t * 2
	m -= t * 3
	c -= t * 3
	if m > 0 and c > 0:
		if not (m == 1 and c == 1):
			ans += 1
	print(ans)


n = int(input())
while n:
	n -= 1
	l = [int(x) for x in input().split()]
	if sum(l) // 3 < min(l[0], l[1]):
		print(sum(l) // 3)
	else:
		print(min(l[0], l[1]))


import sys
import itertools
import math
import collections
from collections import Counter

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
t = ii()
for i in range(t):
	(c, m, x) = mi()
	t = min(c, m, x)
	r = t
	(c, m, x) = (c - t, m - t, x - t)
	if c == 0 or m == 0:
		print(r)
		continue
	else:
		t = min(c, m)
		r += min(t, (c + m) // 3)
		print(r)


def binSearch(a, b, c):
	left = 0
	right = 10 ** 18
	while left + 1 < right:
		a1 = a
		b1 = b
		c1 = c
		mid = (left + right) // 2
		a1 -= mid
		b1 -= mid
		c1 += a1 + b1
		c1 -= mid
		mini = min(a1, b1, c1)
		if mini >= 0:
			left = mid
		elif mini < 0:
			right = mid
	return left
q = int(input())
for i in range(q):
	(x, m, z) = map(int, input().split())
	print(binSearch(x, m, z))


def pt(c, m, x):
	c = int(c)
	m = int(m)
	x = int(x)
	y = (c + m + x) // 3
	z = min(c, m)
	if y <= z:
		print(y)
	else:
		print(z)
q = int(input())
for i in range(q):
	(c, m, x) = input().split()
	pt(c, m, x)


def mp():
	return map(int, input().split())

def it():
	return int(input())
for _ in range(it()):
	(c, m, x) = mp()
	a = min(c, m, x)
	c -= a
	m -= a
	x -= a
	if c == 0 or m == 0:
		print(a)
	else:
		print(a + min(c, m, (c + m) // 3))


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	mi = min(c, m)
	if c - mi + m - mi + x - mi >= 0:
		print(mi)
	else:
		(l, r) = (0, mi)
		while l + 1 < r:
			mid = (l + r) // 2
			if c - mid + m - mid + x - mid >= 0:
				l = mid
			else:
				r = mid
		print(l)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	print(min((a + b + c) // 3, a, b))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	if a <= c and b <= c:
		print(min(a, b))
	else:
		res = 0
		res += c
		a -= c
		b -= c
		ma = max(a, b)
		mi = a + b - ma
		if mi * 2 <= ma:
			print(mi + res)
		else:
			res += ma - mi
			mi = mi * 2 - ma
			ma = mi
			if ma % 3 == 2:
				res += 1
			print(res + ma // 3 * 2)


def func(c, m, x):
	a = min(c, m)
	b = max(c, m)
	if b - a + x >= a:
		return a
	else:
		g = int(a + (x + b - 2 * a) / 3)
		return g
q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	ans = func(c, m, x)
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, c) = [int(x) for x in input().strip().split()]
	res = min(a, b)
	r1 = max(a, b) - min(a, b) + c
	if r1 >= res:
		print(res)
	else:
		res = min(a, b, c)
		a = a - res
		b = b - res
		c = c - res
		r1 = (a + b) // 3
		if r1 > min(a, b):
			res += min(a, b)
		else:
			res += r1
		print(res)


q = int(input())
ans = []
for x in range(q):
	(c, m, x) = map(int, input().split())
	mini = min(c, m)
	if c + m + x >= 3 * mini:
		ans.append(mini)
	else:
		summ = (c + m + x) // 3
		ans.append(summ)
for val in ans:
	print(val)


casos = int(input())
for i in range(casos):
	(c, m, x) = [int(x) for x in input().split()]
	limitante1 = min(c, m)
	if limitante1 <= x:
		print(limitante1)
	else:
		total = c + m + x
		times = total // 3
		print(min(times, limitante1))


def maxTeams(N1, N2):
	q = min(N1, N2)
	z = max(N1, N2)
	if 2 * q <= z:
		return q
	else:
		return (q + z) // 3
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	y = min(c, m)
	if x >= y:
		print(y)
	else:
		c = c - x
		m = m - x
		ans = x
		z = maxTeams(c, m)
		print(ans + z)


import string
import math

def main():
	q = int(input())
	for _ in range(q):
		(c, m, x) = map(int, input().split())
		(c, m, x) = (max(c, m) - abs(c - m), min(c, m), x + abs(c - m))
		maxt = min(c, m)
		conv = min(x, maxt)
		print(conv + (c + m - 2 * conv) // 3)
main()


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	if c + m + x < 3:
		print(0)
	else:
		ans1 = min(c, m)
		print(min(ans1, (c + m + x) // 3))


for x in range(int(input())):
	(a, h, m) = list(map(int, input().split()))
	print(min(a, h, (a + h + m) // 3))


q = int(input())
for _ in range(q):
	(c, m, x) = map(int, input().split())
	if c < m:
		(c, m, x) = (c, c, x + m - c)
	elif c > m:
		(c, m, x) = (m, m, x + c - m)
	ans = min(c, m, x)
	if c > x:
		ans += 2 * (c - x) // 3
	print(ans)


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	arr = [int(x) for x in stdin.readline().split()]
	mini = min(arr[0], arr[1])
	maxi = max(arr[0], arr[1])
	if arr[2] >= mini:
		stdout.write(str(mini) + '\n')
	elif mini == maxi:
		temp = maxi - arr[2]
		ans = arr[2] + int(2 * temp / 3)
		stdout.write(str(ans) + '\n')
	else:
		temp2 = maxi - arr[2]
		temp1 = mini - arr[2]
		if 2 * temp1 <= temp2:
			ans = temp1
		else:
			ans = int((temp1 + temp2) / 3)
		ans = ans + arr[2]
		stdout.write(str(ans) + '\n')


def ok(n):
	if c >= n and m >= n and (x + (c - n) + (m - n) >= n):
		return True
	return False
for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	ans = 0
	low = 0
	high = 10 ** 9
	while low <= high:
		mid = (low + high) // 2
		if ok(mid):
			ans = mid
			low = mid + 1
		else:
			high = mid - 1
	print(ans)


n = int(input())
for nn in range(n):
	val = [int(x) for x in input().split(' ')]
	c = val[0]
	m = val[1]
	x = val[2]
	teams = 0
	t = 0
	if c < m:
		t = c
	else:
		t = m
	step = min(t, x)
	teams += step
	c -= step
	m -= step
	x -= step
	if c > 0 and m > 0 and (c + m >= 3):
		if c >= 2 * m:
			teams += m
		elif m >= 2 * c:
			teams += c
		else:
			teams += (c + m) // 3
	print(teams)


for i in range(int(input())):
	(c, m, x) = map(int, input().split())
	a = min(c, m, x)
	c -= a
	m -= a
	x -= a
	if c == 0 or m == 0:
		print(a)
	else:
		if c < m:
			(c, m) = (m, c)
		print(a + min((c + m) // 3, m))


test_cases = int(input())
while test_cases > 0:
	(code, math, non) = map(int, input().split())
	atMost = min(code, math)
	print(min(atMost, (code + math + non) // 3))
	test_cases -= 1


q = int(input())
members = []
for x in range(q):
	members.append(input().split())
for i in range(q):
	for j in range(3):
		members[i][j] = int(members[i][j])
for k in range(q):
	tempset = []
	minteams = 0
	tempset = members[k]
	if tempset[0] <= tempset[1]:
		minteams = tempset[0]
	else:
		minteams = tempset[1]
	if minteams > sum(tempset) / 3:
		print(int(sum(tempset) / 3))
	else:
		print(minteams)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	tot = min(a, b)
	if a + b + c < tot * 3:
		re = a - tot + b - tot + c
		tot = (a + b + c) // 3
	print(tot)


f = int(input())
while f:
	f = f - 1
	h = list(map(int, input().split()))
	if sum(h) // 3 < min(h[0], h[1]):
		print(sum(h) // 3)
	else:
		print(min(h[0], h[1]))


def numTeam(c, m, x):
	cmMin = min(c, m)
	if x >= cmMin:
		return cmMin
	else:
		return min((c + m + x) // 3, cmMin)
for i in range(int(input())):
	(coder, mathMan, normalMan) = map(int, input().split())
	print(numTeam(coder, mathMan, normalMan))


n = int(input())

def can(mid, a, b, c):
	if a / mid >= 1 and b / mid >= 1 and ((a + b + c) / mid >= 3):
		return True
for i in range(n):
	(a, b, c) = map(int, input().split(' '))
	sumi = a + b + c
	x = 400
	ans = 0
	low = 0
	high = sumi
	try:
		while x != 0:
			mid = (high + low) // 2
			if can(mid, a, b, c):
				ans = mid
				low = mid
			else:
				high = mid
			x = x - 1
	except:
		ans = 0
	print(ans)


Q = int(input())
ans = []
for q in range(Q):
	(c, m, x) = map(int, input().split())
	a = 0
	if c >= x and m >= x:
		a += x
		c -= x
		m -= x
		if c > m:
			tmp = c + m
			if c >= tmp // 3 and m >= tmp // 3:
				a += tmp // 3
			else:
				a += min(m, c // 2)
		elif c == m:
			a += (c + m) // 3
		else:
			tmp = c + m
			if c >= tmp // 3 and m >= tmp // 3:
				a += tmp // 3
			else:
				a += min(c, m // 2)
	else:
		a = min(c, m)
	ans.append(a)
for a in ans:
	print(a)


n = int(input())
while n > 0:
	(a, b, c) = map(int, input().strip().split())
	x = (a + b + c) // 3
	if min(a, b) >= x:
		print(x)
	else:
		print(min(a, b))
	n -= 1


q = int(input())
ls = list(list())
for i in range(q):
	ls.append([a for a in input().split()])
for i in range(q):
	ls1 = ls[i]
	c = int(ls1[0])
	m = int(ls1[1])
	x = int(ls1[2])
	mn = min(c, m)
	ans = min(mn, int((c + m + x) / 3))
	print(ans)


for _ in range(int(input())):
	(c, m, x) = [int(_) for _ in input().split()]
	if min(c, m) <= x:
		print(min(c, m))
	else:
		c -= x
		m -= x
		(c, m) = (max(c, m), min(c, m))
		if m - (c - m) < 0:
			print(x + m)
		elif (m - (c - m)) % 3 == 2:
			print(c - m + x + 2 * ((m - (c - m)) // 3) + 1)
		else:
			print(c - m + x + 2 * ((m - (c - m)) // 3))


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(c, m, x) = iia()
	if (c + m + x) // 3 >= min(c, m):
		print(min(c, m))
	else:
		print((c + m + x) // 3)


n = int(input())
l = []
for i in range(n):
	d = input().split()
	d = [int(i) for i in d]
	l += [d]
for i in l:
	x = min(i[0], i[1])
	if i[2] >= x:
		print(x)
	else:
		y = abs(i[1] - i[0])
		x -= i[2]
		if y < x:
			print(i[2] + (2 * x + y) // 3)
		else:
			print(i[2] + x)


from sys import stdin
from collections import defaultdict
input = stdin.readline
T = int(input())
for t in range(1, T + 1):
	(c, m, x) = map(int, input().split())
	ans = min({c, m, x})
	ans2 = 0
	c -= ans
	m -= ans
	l = 0
	r = (c + m) // 3
	while l <= r:
		mid = l + (r - l) // 2
		yes = False
		min_ = min(c, m)
		max_ = max(c, m)
		if min_ >= mid:
			if max_ < mid * 2:
				if mid * 2 - max_ <= min_ - mid:
					yes = True
			else:
				yes = True
		if yes:
			ans2 = mid
			l = mid + 1
		else:
			r = mid - 1
	print(ans + ans2)


t = int(input())
for o in range(t):
	(c, m, x) = map(int, input().split())
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c = c - d
	elif m > c:
		m = m - d
	ans = min(c, m, x)
	c = c - ans
	m = m - ans
	x = x - ans
	ans += (c + m) // 3
	print(ans)


q = int(input())
while q > 0:
	q -= 1
	data = input().split()
	c = int(data[0])
	m = int(data[1])
	x = int(data[2])
	mini = c
	sumWithoutMini = m + x
	if mini > m:
		mini = m
		sumWithoutMini = c + x
	if c == 0 or m == 0:
		print(0)
	elif c + m + x >= 3:
		if sumWithoutMini >= 2 * mini:
			print(mini)
		else:
			print(int((c + m + x) / 3))
	else:
		print(0)


n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	spe = min(c, m)
	mem = (c + m + x) // 3
	print(min(spe, mem))


test_cases = int(input())
for _ in range(test_cases):
	(m, c, u) = list(map(int, input().split(' ')))
	print(min(m, c, int((m + c + u) / 3)))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a > b:
		c += a - b
		a = b
	elif a < b:
		c += b - a
		b = a
	if a > c:
		print((a + b + c) // 3)
	else:
		print(a)


for _ in range(int(input())):
	(c, m, x) = [int(x) for x in input().split()]
	can_do = min(c, m)
	sums = sum([c, m, x])
	if sums >= can_do * 3:
		print(can_do)
	else:
		print(sums // 3)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split(' '))
	respuesta = 0
	suma = c + m + x
	respuesta = suma // 3
	respuesta = min(respuesta, min(c, m))
	print(respuesta)


for i in range(int(input())):
	(c, m, x) = [int(var) for var in input().split()]
	d = max(c, m) - min(c, m)
	x += d
	if c > m:
		c -= d
	else:
		m -= d
	ans = min(c, m, x)
	ans += (c + m - 2 * ans) // 3
	print(ans)


import sys
import math as mt
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(c, m, x) = map(int, input().split())
	maxi = max(c, m)
	mini = min(c, m)
	diff = maxi - mini
	x += diff
	maxi -= diff
	min1 = min(mini, maxi, x)
	maxi -= min1
	mini -= min1
	x -= min1
	print(min1 + (maxi + mini) // 3)


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	a = min(x, y)
	if a <= z:
		print(a)
	else:
		print(min(x, y, (x + y + z) // 3))


q = int(input())
a = []
for i in range(q):
	a.append(list(map(int, input().split())))
b = []
for i in range(q):
	max = (a[i][0] + a[i][1] + a[i][2]) // 3
	b.append(min(a[i][0], a[i][1], max))
for i in b:
	print(i)


def perfect(c, m, x):
	sm = min(c, m)
	if c + m + x < 3:
		return 0
	elif (c + m + x) // 3 <= sm:
		return (c + m + x) // 3
	else:
		return sm
q = input()
q = int(q)
while q:
	s = list(map(int, input().split()))
	c = s[0]
	m = s[1]
	x = s[2]
	print(perfect(c, m, x))
	q -= 1


entrada = int(input())
for i in range(entrada):
	aux = input().split()
	(c, m, x) = (int(aux[0]), int(aux[1]), int(aux[2]))
	aux = c + m + x
	print(min(aux // 3, min(c, m)))


a = int(input())
for i in range(a):
	(x, y, z) = input().split()
	x = int(x)
	y = int(y)
	z = int(z)
	if x == y:
		if z >= x:
			print(x)
		else:
			print(z + (y - z) * 2 // 3)
	elif x > y:
		if x - y + z >= y:
			print(y)
		else:
			t = x - y + z
			print(t + (y - t) * 2 // 3)
	elif y - x + z >= x:
		print(x)
	else:
		t = y - x + z
		print(t + (x - t) * 2 // 3)


q = int(input())
for i in range(q):
	(c, m, x) = map(int, input().split())
	num = min(c, m)
	num2 = c + m + x - num * 2
	if num2 >= num:
		print(num)
	else:
		print((c + m + x) // 3)


def check(mid, c, m, x):
	if min(c, m) < mid:
		return False
	else:
		if c + m + x >= 3 * mid:
			return True
		return False
t = int(input())
for i in range(t):
	(c, m, x) = list(map(int, input().split()))
	if c == 0 or m == 0 or c + m + x == 0:
		print(0)
	else:
		start = 0
		end = c + m + x
		while start < end:
			mid = (start + end) // 2
			if check(mid, c, m, x):
				ans = mid
				start = mid + 1
			else:
				end = mid
		print(ans)


n = int(input())
for i in range(n):
	arr = list(map(int, input().split()))
	X = sum(arr) // 3
	Y = min(arr[0], arr[1])
	Z = min(X, Y)
	print(Z)


q = int(input())
for i in range(q):
	(a, b, c) = map(int, input().split())
	if a < b:
		val = a
	else:
		val = b
	if (a + b + c) // 3 > val:
		print(val)
	else:
		x = (a + b + c) // 3
		if x > val:
			print(val)
		else:
			print(x)


q = int(input())
for i in range(q):
	(c, m, x) = list(map(int, input().split()))
	s = c + m + x
	if s // 3 >= min(c, m):
		print(min(c, m))
	elif s // 3 == 0 or m == 0 or c == 0:
		print(0)
	else:
		ans = min(c, m, x)
		c = c - ans
		m = m - ans
		x = x - ans
		ans += (c + m) // 3
		print(ans)


import math
n = int(input())
for i in range(n):
	(c, m, x) = map(int, input().split())
	mins = 0
	mins = min(c, m, x)
	grp = 0
	grp = mins + grp
	(c, m) = (c - grp, m - grp)
	if mins == x:
		if c != 0 and m != 0:
			if c / m > 2 or m / c > 2:
				grp = grp + min(c, m)
			else:
				grp = grp + math.floor((c + m) / 3)
	print(grp)


for _ in range(int(input())):
	(c, m, x) = map(int, input().split())
	val = min(c, m)
	flag = 0
	if x < val:
		fin = x
		flag = 1
	else:
		fin = val
	if flag:
		val1 = min(c - fin, m - fin)
		pos = (c + m - 2 * fin) // 3
		fin += min(val1, pos)
	print(fin)


q = int(input())
kq = []
for i in range(0, q):
	cmx = input()
	cmx = cmx.split()
	cmx[0] = eval(cmx[0])
	cmx[1] = eval(cmx[1])
	cmx[2] = eval(cmx[2])
	if min(cmx) == cmx[0] or min(cmx) == cmx[1]:
		kq.append(min(cmx))
	else:
		c = cmx[0] - cmx[2]
		m = cmx[1] - cmx[2]
		a = (c + m) // 3
		if a <= c and a <= m:
			kq.append(cmx[2] + a)
		else:
			kq.append(cmx[2] + min(c, m))
for i in range(0, q):
	print(kq[i])