Problem1291--zzk's trouble(2)

1291: zzk's trouble(2)

[Creator : ]
Time Limit : 1 sec  Memory Limit : 128 MB

Description

After the piggery event, the No. 1023 big dog was very angry, and he decided to make things difficult for ZzK, so he gave ZzK a number of M, for a given natural number M, to find out all the continuous natural numbers (the number of consecutive numbers greater than 1), and the sum of the total number of these continuous natural segments was M. If ZzK doesn't figure out, No. 1023 is going to tear down his pigsty, and ZzK doesn't want his pig raising business to fall down just now. Please help ZzK.

For example:1998+1999+2000+2001+2002 = 10000 so from 1998 to 2002 is one of the solve of M=10000.

Input

A single row containing an integer gives the value of M (10 < = M < 2000000).

Output

Each row of two natural numbers gives the first and last number in a continuous natural number segment satisfying the condition. The number is separated by a space. The first of all the output lines is arranged in a ascending order from small to large, and at least one solution is guaranteed for the given input data.

Sample Input Copy

10000

Sample Output Copy

18 142 
297 328 
388 412 
1998 2002

HINT

回溯、搜索

Source/Category