Time limit: 3 sec
In 1881 , gentleman p k mukhopaddhay discoverd an interesting character of number with three digit where every digit are different. If we take a number with three digit where every digit are different,we can see something interesting. That described below:
If we take 251 , the digits are 2 5 and 1 . The biggest number that can be formed by 2 5 and 1 is 521 and the smallest number that can be formed by 2 5 and 1 is 125.The difference of 521 and 125 is 396.If we again consider the above calculation , we can get another number. After accomplishing the same task again and again,once we can get 495 , which is durga constant.
Your task is to calculate the number of performing the calculation to get durga constant.
Input starts with an integer T (≤ 15), denoting the number of test cases.
Each of the next T lines, contains an integer N.
For each case, print the case number and the required number.
Case 1: 3
August Contest, 2014
Problem Setter: Harunur Rashid