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 <=10

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.

ShubhamJain18 | 205 |

makeitdonesolo | 140 |

lost_found | 124 |

maggiiiii | 118 |

SahatPrasad1 | 108 |

Bishnu Dev Panda | 777 |

okayboss | 551 |

ShubhamJain18 | 516 |

yk12 | 514 |

makeitdonesolo | 480 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.