Factorial Division

Given two positive integers n, m, find out n!/m!, where n! = 1 ∗ 2 ∗ 3 ∗ . . . ∗ n (n ≥ 1). For example, if n = 6, m = 3, 6!/3! = 720/6 = 120. Easy, right? Now let’s do the reverse: given k = n!/m!, find out the pair (n, m) (n > m ≥ 1). If there is more than one solution, n should be as small as possible. For example, if k = 120, the answer should be n = 5 and m = 1, not n = 6 and m = 3, because 5!/1! = 6!/3! = 120, and 5 < 6. Input There will be at most 100 test cases. Each test case contains one integer k (1 ≤ k ≤ 109). Output For each test case, print two integers n and m. If there is no solution, print ‘Impossible’. If there is more than one solution, n should be as small as possible. Sample Input 120 1 210 Sample Output Case 1: 5 1 Case 2: Impossible Case 3: 7 4