Genius
Time Limit:1.5S Memory Limit:65536K
Description
For each natural number N (N>0),
Primary school students know if there exists an integer a, such that a2=N, then N is a perfect square.
Junior school students know if sqrt(N) is an irrational number, N is not a perfect square(square-free). High school students know that N is a perfect square if and only if there exists two positive integers X and Y, such that N=X2/Y2.
College students know that N is square-free if and only if there exists two positive integers X and Y, such that N=(X2-1)/Y2.
As a mathematics and programming genius, you know far more than them. Not only are the above four simple propositions a piece of cake to you, but also you can tell them how much X and Y are for each square-free N, such that (X2-1)/Y2=N.
You need to write a program which inputs an integer N and outputs X and Y.
Such X and Y may be multiple. Please output the minimum X and Y.
Input
The input consists of several test cases. Each test case is in a separate line, and consists of a single integer in the range 1 ... 10^8.
The last case is followed by a line containing an integer zero.
Output
For each test case, display a line that contains X and Y. if either X or Y is greater than or equal to 10^1000, output 'No solution!'.
Sample Input
3
57
81
0
Sample Output
Case 1:
2 1
Case 2:
151 20
Case 3:
No solution
谁能解决?