for i in range(int(eval(input()))):

	c,a,n = list(map(int,input().split()))

	cnt = 0

	while True:

		if c<1 or a<1 or n<1:

			break

		c -= 1

		a -= 1

		n -= 1

		cnt += 1

	while True:

		if c<2 or a<1:

			break

		c -= 2

		a -= 1

		cnt += 1

	while True:

		if c<3:

			break

		c -= 3

		cnt += 1

	print(cnt)
for i in range(int(eval(input()))):

	c,a,n = list(map(int,input().split()))

	cnt1 = min(c,a,n)

	c -= cnt1

	a -= cnt1

	cnt2 = min(c//2,a)

	c -= cnt2*2

	cnt3 = c//3

	print((cnt1+cnt2+cnt3))
for i in range(int(eval(input()))):
    c, a, n = list(map(int, input().split()))
    cnt = 0
    while True:
        if c < 1 or a < 1 or n < 1:
            break
        c -= 1
        a -= 1
        n -= 1
        cnt += 1
    while True:
        if c < 2 or a < 1:
            break
        c -= 2
        a -= 1
        cnt += 1
    while True:
        if c < 3:
            break
        c -= 3
        cnt += 1
    print(cnt)

for i in range(int(eval(input()))):
    c, a, n = list(map(int, input().split()))
    cnt1 = min(c, a, n)
    c -= cnt1
    a -= cnt1
    cnt2 = min(c // 2, a)
    c -= cnt2 * 2
    cnt3 = c // 3
    print((cnt1 + cnt2 + cnt3))

-    cnt = 0 -    while True: -        if c < 1 or a < 1 or n < 1: -            break -        c -= 1 -        a -= 1 -        n -= 1 -        cnt += 1 -    while True: -        if c < 2 or a < 1: -            break -        c -= 2 -        a -= 1 -        cnt += 1 -    while True: -        if c < 3: -            break -        c -= 3 -        cnt += 1 -    print(cnt) +    cnt1 = min(c, a, n) +    c -= cnt1 +    a -= cnt1 +    cnt2 = min(c // 2, a) +    c -= cnt2 * 2 +    cnt3 = c // 3 +    print((cnt1 + cnt2 + cnt3))