p00276 Formation
At Akabe High School, which is a programmer training school, the roles of competition programmers in team battles are divided into the following three types.
C: | Coder | I am familiar with the language and code.
--- | --- | ---
A: | Algorithm | I am good at logical thinking and think about algorithms.
N: | Navigator | Good at reading comprehension, analyze and debug problems.



At this high school, a team of three people is formed in one of the following formations.

CCA: | Well-balanced and stable
--- | ---
CCC: | Fast-paced type with high risk but expected speed
CAN: | Careful solving of problems accurately



As a coach of the Competitive Programming Department, you take care every year to combine these members and form as many teams as possible. Therefore, create a program that outputs the maximum number of teams that can be created when the number of coders, the number of algorithms, and the number of navigators are given as inputs.



input

The input consists of one dataset. Input data is given in the following format.


Q
c1 a1 n1
c2 a2 n2
::
cQ aQ nQ


Q (0 ≤ Q ≤ 100) on the first line is the number of years for which you want to find the number of teams. The number of people by role in each year is given to the following Q line. Each row is given the number of coders ci (0 ≤ ci ≤ 1000), the number of algorithms ai (0 ≤ ai ≤ 1000), and the number of navigators ni (0 ≤ ni ≤ 1000).

output

Output the maximum number of teams that can be created on one line for each year.

Example

Input

4
3 0 0
1 1 1
9 4 1
0 1 2


Output

1
1
4
0
```python
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0281

"""
import sys
from sys import stdin
input = stdin.readline


def solve(c, a, n):
    CCA, CCC, CAN = 0, 0, 0
    CAN = min(c, a, n)                     #  CAN??????????????°
    c -= CAN
    a -= CAN

    if a > 0 and c > 0:
        CCA = min(a, c//2)        #  CCA??????????????°
        c -= (CCA * 2)
    if c > 2:
        CCC = c // 3         # CCC??????????????°
    return CAN + CCA + CCC


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


if __name__ == '__main__':
    main(sys.argv[1:])
```