Raj has invented a binary tree that he calls R-tree. Every R-tree has the following properties-
The height of the tree is defined as the number of edges from the root to the deepest leaf.
Following is a valid R-tree with root node value of 20 and height 6.
It follows from the above rules that no children are possible for a node with a prime value. The task is to find the maximum possible height of an R-tree given its root node value. Help Raj in solving this problem.
The first line of the input gives the number of test cases, T. T test cases follow. Each test case starts with one line with one integer N, which represents the value of the root node.
For each test case, output one line containing "Case #x:", where x is the test case number (starting from 1). Then, for every value N in the test case, output the maximum possible height of all R-trees with root N.
0 < T <= 20
2 <= N <= 1014
For the first test case, there is only one tree possible as 2 is a prime number. So, height of the R-tree is 0 as there is just one node.
For the second test case, there are two trees possible -
Therefore, maximum height is 2.
For the third test case, 31 is again a prime number and maximum possible height is 0.