Home => ProblemSet => 6.1-19:[SPOJ1739]EQU2 - Yet Another Equation
Problem2126--6.1-19:[SPOJ1739]EQU2 - Yet Another Equation

2126: 6.1-19:[SPOJ1739]EQU2 - Yet Another Equation

Time Limit: 5 Sec  Memory Limit: 1500 MB  Submit: 0  Solved: 0
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

Consider the equation
x2 - ny2 = 1
where n is some integer.
Find the smallest strictly positive integer solutions (x, y) for a given n.

Input

The number of test cases t (around 30), followed by a list of t values of n (2 ≤ n ≤ 1000). 
You can assume that the equation can be solved for all values of n in the input set.

Output

For every test case, the values of x and y separated by a space character, on separate lines.

Sample Input Copy

3
2
6
61

Sample Output Copy

3 2
5 2
1766319049 226153980

Source/Category

数论