Time limit: 1s
Memory limit: 32MB
Input:
Output:
Task
You are given pairs of positive integers. Find for each pair the greatest common divisor (gcd) and the least common multiple (lcm).
We define the greatest common divisor (gcd) of a pair as the largest integer that is a divisor of both and . We will note this as .
We define the least common multiple (lcm) of a pair as the smallest integer that is a multiple of both and . We will note this as .
Input data
The first line of the input will contain , the number of test cases. The following lines will contain the two values from each pair, and .
Output data
Each of the lines will have two numbers, representing the gcd and the lcm of the two numbers.
Constraints and clarifications
- For tests worth points, .
Example
stdin
5
14 8
55 33
63 94
39 27
24 54
stdout
2 56
11 165
1 5922
3 351
6 216
Explanation
, , etc.