Treasure Map#3132

Treasure Map

1 second
32 megabytes
Medium

"Take 147 steps due north, turn 63 degrees clockwise, take 82 steps, ...". Most people don't realize how important accuracy is when following the directions on a pirate's treasure map. If you're even a little off at the start, you may end up far from the correct location at the end. For this reason, pirates use very exact definitions. For example, one step was defined by the 1670 Pirate Convention as exactly twice the size of Long John Silver's wooden leg, that is, m in metric units.

Captain Borbassa was not worried while heading to the treasure island: he had a rope with knots exactly one step apart for measuring distance, and he brought the geotriangle his father gave him when he was six years old.

However, upon closer inspection of the map, he received an unpleasant surprise. The map was drawn by the famous Captain Jack Magpie, who was known for adding clever tricks to his instructions. In this case, distances such as steps were listed. How to measure those precisely? Luckily, his first mate Pythagor came to the rescue. After several hours, he proposed a solution: pirate A goes steps in the perpendicular direction and holds one end of the measuring rope. Then, pirate B walks in the desired direction while letting the rope slide through his fingers until he is exactly steps from pirate A. Pythagor devised a formula showing that pirate B has travelled the right number of steps.

Captain Borbassa was impressed, but revealed there were even more such distances on the map. Being paranoid, he would not let Pythagor see the map or even tell him what the other distances are. All he would say is that they are all square roots of integers. On the island, the captain will reveal the numbers, and then expects Pythagor to quickly compute the smallest two integer step lengths that can combine to produce the required distance using the described method.

Pythagor knows this isn't easy and asks for your help. Can you write a program to quickly find these two integers? He asked the captain how big the numbers under the square root could be, and the captain answered "one billion." He was probably exaggerating, but make sure your program works for any input.

If you succeed, you'll get a share of the treasure — it could be gold, silver or even... a treasure map!

Input

The first line of input contains a single integer: the number of test cases.

Each test case has the following format:

  • One line with one integer , where 1 \leq N \leq 10^9.

Output

For each test case output two non-negative integers, separated by a space, on a single line: the distance pirate A needs to head in the perpendicular direction and the final distance between pirates A and B, such that pirate B has travelled the required number of steps. If multiple solutions exist, print the one with the smallest numbers. If no solution exists, output IMPOSSIBLE on a single line.

Examples

Example 1

Loading
Loading