Lohia , Gosu and Prince are footballers. Lohia and Gosu are strikers while Prince is a goalkeeper. You as the coach held a practice session of penalty shootouts to improve the performance of the strikers . Your task is to find the maximum goal scorer between the two.

Lohia, Gosu and Prince energy is denoted by X, Y and Z respectively. For every goal scored the energy of the respective player is decreased by 1 and after every save Prince energy is decreased by 1. Strikers will be able to score the goal if Prince energy is a factor of their energy otherwise not.

The session ends when Prince's energy reaches 1.

Assume same player can try for goals repeatedly and they both try to increase number of goals in totality. Lohia being a junior player is always favoured for penalty kick.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Each test case contains energy 3 integers **X, Y **&** Z , **denoting the energies respectively.

**Output:**

For each test case print the number of goals scored by Lohia and Gosu respectively.

**Constraints:**

1 <= T <= 100

1 <= X,Y,Z <= 10^{5}

**Example:**

**Input:**

2

4 9 5

13 10 7

**Output:**

3 2

0 3

**Explanation:**

**Case 1:**

Goal will not be scored because Z is not a factor of X and Y hence (X-4 , Y-9 , Z-4). Now goal will be scored by (X=1) X-3 , Y-9 , Z-4 ---> X-3 , Y-9 , Z-3 ---> (X=2)X-2, Y-9 , Z-3 ---> (X=2 , Y=1)X-2 , Y-8 , Z-3 ---> X-2, Y-8 , Z-2 ---> (X=3 , Y=1)X-1, Y-8 , Z-2 ---> (X=3, Y=2)X-1 , Y-7 , Z-1. Now the session will end because Prince’s energy reaches 1.

**Case 2:**

Since X is a prime number goal by X will never be scored therefore only Y will be able to score.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

tushki | 198 |

namansharmacse17 | 110 |

TusharMittal3 | 70 |

adkeaesph | 57 |

deepakchoudhary11 | 48 |

ARUN_PUNDIR | 720 |

manishgupta8497 | 623 |

AMAN__JAIN | 596 |

Abhimanyu_kumar | 562 |

Bicky_Shokeen | 532 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.