#P10858. [HBCPC2024] Long Live
[HBCPC2024] Long Live
Description
In Minecraft, there are three dimensions in the simple world, one of which is known as “The End”. In this dimension, the Ender Dragon is usually symbolized as the final boss of Minecraft.

Now we, you, and Steve want to beat the dragon. However, we find that the dragon is telling a puzzle. We must solve it before fighting against the dragon. Please stand by our side to fight against the dragon. The puzzle goes as follows.
Given two positive integers and , please find two integers and , such that
$$\sqrt{\dfrac{\operatorname{lcm}(x,y)}{\gcd(x,y)}}=a\sqrt{b}$$and to maximize .
Here, represents the greatest common divisor of , while represents the least common multiple of .
Input Format
The first line contains an integer indicating the number of test cases.
Of the following lines, each contains two integers and , representing the puzzle.
Output Format
Output lines. Each contains two integers and , indicating the answer to each test case.
2
1 1
4 4
1 1
1 1
Hint
Dear all participants:
This problem may be the very first page, but not where the story line ends. Please believe in yourself all the time, wishing you with my singing, “Long live all the mountains we moved, I had the time of my life fighting dragons with you”.
京公网安备 11011102002149号