Hide

Problem A
Parket

Ivica has set up a new parquet flooring in his room. The room is $L$ decimeters long and $W$ decimeters wide.

The blocks are of quadratic shape and each has an area of one quadratic decimeter. Once Ivica had set up the flooring, which consists of brown-colored blocks, he decided to paint the blocks on the edge of the room red.

The picture below illustrates the scenario from the Sample Input 2 - outer blocks are red, while the remaining two inner blocks are brown:

\includegraphics[width=0.3\textwidth ]{fig}

Marica has come to visit Ivica. While Ivica was serving her cookies, she counted the number of blocks of each color. When she returned home, she recalled of the two numbers and wished to calculate the dimensions of Ivica’s room. Help her!

Input

The first and only line of input contains two integers separated by a space, $R$ (the number of red blocks) and $B$ (the number of brown blocks). The following constraints will apply: $8 \le R \le 5\, 000$, $1 \le B \le 2\, 000\, 000$.

Output

The first and only line of output must contain the dimensions of the room, $L$ and $W$, respectively. If the numbers differ, output the greater one first. The test data will be such that the solution is unique.

Sample Input 1 Sample Output 1
8 1
3 3
Sample Input 2 Sample Output 2
10 2
4 3
Sample Input 3 Sample Output 3
24 24
8 6

Please log in to submit a solution to this problem

Log in