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: interview

Starter code:

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

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

for i in range(int(input())):
    c,m,x=map(int,input().split())
    print(min((c+m+x)//3,c,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))

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

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)]))

Q = int(input())
for q in range(Q):
    c, m, x = tuple(map(int, input().split()))
    ans = min(c, m)
    #m = ans
    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)


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
    #print("y",y)
    if y<=c+m+x:
        print(y)
    else:
        print((c+m+x+y*2)//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

n=int(input())
while 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]))

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())

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())


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)


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())
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))


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()


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

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))

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)


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

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)


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

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

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()

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)