Palindromic Bases

A palindrome is a number which looks the same when reversed. 1, 11, 343 etc. are examples of palindromes, while 12, 1122 etc. are not. Interesting thing is, some number may not be palindrome in decimal but in other bases. For example, if we convert 12 in base 5, (12)10 = (22)5. So we can see that 12 is a palindrome in base 5. Length of a palindrome is the number of digits in that number. No leading zeroes are allowed in palindromes. Given a number N, how many bases B are there, where N will be an even length palindrome if represented as a B base number. Input First line will contain an integer number T (0 < T ≤ 100), number of test cases. Each case contains one line with an integer N (0 ≤ N ≤ 1014). Output For each case print the case number then the answer. If there are infinite bases possible for a particular N, you should output ‘Infinity’. See sample I/O for more clarification. Note: Explanation for sample inputs: Case 1: the base is 2. Case 2: the base is 3. Case 3: the bases are 5 and 11. Sample Input 3 3 4 12 Sample Output Case 1: 1 Case 2: 1 Case 3: 2