eolymp
bolt
Try our new interface for solving problems
Problems

GCD and LCM

GCD and LCM

Two integers $a$ and $b$ are given. Find \textbf{GCD} and \textbf{LCM} of $a$ and $b$. \InputFile The first line contains the number of testcases $t$. Then follow $t$ lines, each line contains two integers $a$ and $b~(1 \le a, b \le 10^9)$. \OutputFile For each test case print on a separate line the \textbf{GCD} and \textbf{LCM} of $a$ and $b$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3
5 7
12 18
330 180
Output example #1
1 35
6 36
30 1980