Chakde India

0

0 votes
Very-Easy
Problem

Appro is the coach of Indian Women's Hockey team. She is currently training two teams Team A and Team B for the 2018 Women's Hockey World Cup to be held in London,England.

Team A consists of M players and B consists of N players.

To enhance the training she wants to divide them into groups of K players with every group being composed of people of only one of the original two teams.

Appro wants to know what is the maximum k for which this is possible?

Input:

The first line of input contains single integer T denoting the number of test cases.

Each line of test case contains 2 space separated integers M and N as specified in the problem.

Output:

For each test case, output the maximum value of K.

Constraints:

Subtask 1: 30 Points

1T100

1M,N105

Subtask 2: 30 Points

1T1000

1M,N109

Subtask 3: 40 Points

1T105

1M,N1018

Sample Input
1
2 2
Sample Output
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?