Time limit
1s
Memory limit
128 MB
You are given the greatest common divisor and the least common multiple of two natural numbers. Find two natural numbers whose greatest common divisor and least common multiple are exactly those two given values.
There can be several valid pairs. For instance, if the greatest common divisor is 6 and the least common multiple is 180, possible pairs include (12, 90), (30, 36), (18, 60), and (6, 180). Among all valid pairs, choose the one with the smallest sum.
Write a program that finds the two natural numbers.
The first line contains two natural numbers G and L separated by a space. G is the greatest common divisor of the two numbers to find, and L is their least common multiple. Both numbers are between 2 and 100,000,000, inclusive.
Print the two natural numbers that satisfy the condition, in increasing order, separated by a space. If there are multiple valid pairs, print the pair whose sum is as small as possible.