Babul’s favourite number is 17. He likes the numbers which are divisible by 17. This time what he does is that he takes a number N and tries to find the largest number which is divisible by 17, by rearranging the digits. As the number increases he gets puzzled with his own task. So you as a programmer have to help him to accomplish his task.
Note: If the number is not divisible by rearranging the digits, then print “Not Possible”. N may have leading zeros.
The first line of input contains an integer T denoting the no of test cases. Each of the next T lines contains the number N.
For each test case in a new line print the desired output.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes