In the mysterious Realm of Numericon, a group of ancient mathematicians discovered a unique pattern related to prime numbers. They found that to uncover the deepest secrets of Numericon, one must determine the largest such that divides where and are integral parts of the mystery.
As the chosen one to unlock Numericon's secrets, you are tasked with creating a program to calculate the maximum value of for given and Can you unveil the hidden wisdom of Numericon and become the savior of this mystical land?
The first line of the input contains an integer indicating the number of tests to be conducted.
Each of the following lines consists of three integers and separated by a space.
Constraints
You have to output lines in format “Case : ”(without quotes) where is the test case number and is the result of the test case. Check out the samples for more clarification.
Input | Output |
---|---|
5 8 3 2 10 5 3 5 4 4 9 5 7 16 8 3 | Case 1: 3 Case 2: 2 Case 3: 0 Case 4: 1 Case 5: 2 |
Explanation
|
Be careful about the output formatting and newline (‘\n’) at the end.