Given a positive integer you have to find it’s lonely divisor. The question is what is Lonely Divisor, right? A lonely divisor of is the only divisor which has exactly divisors. If there are more than one divisor having exactly divisors then they are not lonely.
Initially I told you that I will give you a positive integer and you have to find it’s lonely divisor. But I have changed my mind. Instead of giving you a number I will give you a range and a positive integer . You have to find the number in range inclusively which has the largest Lonely Divisor. Note that Lonely Divisor must have exactly divisors.
If there are many solutions just choose the largest number. If there are no solution then just print .
Input will start with a positive integer denoting the number of test cases. Each test case will have three positive integer denoting the range and .
Use faster I/O as the input will be large.
For each test case print the number with the largest lonely divisor followed by a space, followed by the lonely divisor.
Note that if there are many solutions you have to print the largest number. In case if there is no solution just print . Also look at the sample I/O for better understanding.
3 1 6 2 1 8 3 1 10 5
5 5 8 4 -1
: There are integers and which have a lonely divisor having exactly divisors. has the largest lonely divisor which is . So the answer is . Note that also has and as its divisor and they have exactly divisors. But they are not lonely.
: In that range only has divisors. Now is not only a divisor of itself but also a divisor of . And both and have only one divisor which has exactly divisors. So possible answer is either or . As we have more than one solution we need choose the largest one. So the answer is .
: There is no number in that range has divisors.
Login to submit