12991299 SUSTech Online Judge
Problem 1299 --Pisces and energy stones

## 1299: Pisces and energy stones

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 98  Solved: 30
[Submit][Status][Web Board]

## Description

Across the mountains and rivers, Pisces finally came to the dragon. Now it's time to fight! There are some energy stones in Pisces's backpack, and each of them belongs to exactly one of the three categories: fire, wind, and soil. To launch an attack, Pisces has to consume 3 energy stones, which must contain at least 1 fire stone and 1 wind stone. Given the number of each kind of stones, Pisces wants to know what is the maximum number of attacks that he can launch.

## Input

The first line contains a single integer $$T(1\leq T\leq10^4)$$ — the number of test cases.

Each of the next $$T$$ lines contains 3 integers $$f$$, $$w$$, and $$s(0\leq f,w,s\leq10^8)$$ — the number of fire, wind and soil stones respectively.

## Output

For each test case, print the maximum number of attacks.

## Sample Input

6
1 1 1
3 6 0
0 0 0
0 1 1
10 1 10
4 4 1

## Sample Output

1
3
0
0
1
3

[Submit][Status]