Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/ekub-va-ekuk

GCD and LCM

Medium 1000 ms 64 MB 45%
Share

You are given $q$ queries, each with two positive integers $a$ and $b$. For every query find the greatest common divisor $\gcd(a, b)$ and the least common multiple $\operatorname{lcm}(a, b)$ of $a$ and $b$.

The common divisor and the common multiple of two numbers shown as segments

Input

The first line contains a positive integer $q$. Each of the next $q$ lines contains two positive integers: $a$ and $b$.

Output

For every query, on its own line, two integers: $\gcd(a, b)$ and $\operatorname{lcm}(a, b)$.

Note

$1 \le q \le 10^{5}$
$1 \le a, b \le 10^{9}$

Examples

Input #1
3
12 18
7 5
10 10
Output #1
6 36
1 35
10 10
Input #2
1
1000000000 999999999
Output #2
1 999999999000000000

Sign in to submit a solution

Signing up is free and takes a minute.