Two integers A and B are the inputs. Write a program to find GCD and LCM of A and B.

-----Input-----

The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer A and B. 

-----Output-----
Display the GCD and LCM of A and B separated by space respectively. The answer for each test case must be displayed in a new line.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ A,B ≤ 1000000

-----Example-----
Input
3 
120 140
10213 312
10 30

Output

20 840
1 3186456
10 30

Difficulty: EASY

Solutions:
def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	lcm = x * y // GCD(x, y)
	return lcm
t = int(input())
while t > 0:
	(x, y) = list(map(int, input().split()))
	print(GCD(x, y), LCM(x, y))
	t -= 1


from math import *
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	g = gcd(a, b)
	l = a * b // g
	print(g, l)


import numpy as np
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(np.gcd(a, b), np.lcm(a, b))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	y = min(a, b)
	x = max(a, b)
	mi = y
	ma = x
	while y:
		(x, y) = (y, x % y)
	gcd = x
	lcm = ma * (mi // gcd)
	print(gcd, end=' ')
	print(lcm)


import math
for t in range(int(input())):
	(a, b) = map(int, input().split())
	x = math.gcd(a, b)
	y = a * b // x
	print(x, y)


from sys import stdin, stdout

def gcd(A, B):
	if B == 0:
		return A
	else:
		return gcd(B, A % B)
for _ in range(int(stdin.readline())):
	(A, B) = list(map(int, stdin.readline().split()))
	g = gcd(A, B)
	l = A // g * B
	stdout.write(str(g) + ' ')
	stdout.write(str(l) + '\n')


def GCD(A, B):
	while B:
		(A, B) = (B, A % B)
	return A

def LCM(A, B):
	return A * B // GCD(A, B)
T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	a = LCM(A, B)
	b = GCD(A, B)
	print(str(b) + ' ' + str(a))


def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
for i in range(int(input())):
	(x, y) = map(int, input().split())
	print(gcd(x, y), lcm(x, y))


import math
n = int(input())
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	x = math.gcd(a, b)
	y = a * b // x
	print(x, y)


r = int(input())
for i in range(r):
	num = [int(x) for x in input().split(' ')]
	a = min(num)
	b = max(num)
	multiply = a * b
	while b:
		(a, b) = (b, a % b)
	hcf = a
	lcm = multiply / hcf
	print(hcf, int(lcm))


import math
N = int(input())
for i in range(N):
	(a, b) = list(map(int, input().split()))
	c = math.gcd(a, b)
	lcm = a * b // c
	print(c, lcm)


def GCD(a, b):
	if b == 0:
		return a
	else:
		return GCD(b, a % b)
n = int(input())
for i in range(n):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	c = GCD(a, b)
	d = a * b // c
	print(c, d)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	(x, y) = (a, b)
	while y:
		(x, y) = (y, x % y)
	gcdno = x
	lcmno = a * b // gcdno
	print(gcdno, end=' ')
	print(lcmno)
	t -= 1


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	lcm = x * y // gcd(x, y)
	return lcm
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	print(gcd(x, y), lcm(x, y))


a = int(input())
for z in range(a):
	b = sorted(list(map(int, input().split())))
	x = b[1]
	y = b[0]
	while y != 0:
		r = x % y
		x = y
		y = r
		gcd = x
	lcm = b[0] * b[1] // gcd
	print(f'{gcd} {lcm}')


def hcf(a, b):
	if a == 0:
		return b
	return hcf(b % a, a)

def lcm(a, b):
	return a // hcf(a, b) * b
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(hcf(a, b), lcm(a, b))


t = int(input())

def gcd(a, b):
	while a != b:
		if a > b:
			a = a - b
		else:
			b = b - a
	return a
for _ in range(t):
	(int_1, int_2) = list(map(int, input().split()))
	hcf = gcd(int_1, int_2)
	lcm = int_2 * int_1 / hcf
	print(int(hcf), int(lcm))


import math

def find():
	(x, y) = list(map(int, input().split()))
	a = math.gcd(x, y)
	lcm = x * y // a
	print(a, lcm)
for i in range(int(input())):
	find()


import math
T = int(input())
while T > 0:
	(A, B) = map(int, input().split())
	hcf = math.gcd(A, B)
	lcm = A * B // hcf
	print(hcf, lcm)
	T = T - 1


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(math.gcd(a, b), a * b // math.gcd(a, b), sep=' ')


import math

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // math.gcd(a, b)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	gcd_value = gcd(a, b)
	lcm_value = lcm(a, b)
	print(gcd_value, lcm_value)


x = int(input())
for i in range(x):
	(a, b) = map(int, input().split())
	(n1, n2) = (a, b)
	while a % b != 0:
		(a, b) = (b, a % b)
	l = n1 * n2 // b
	print(b, l)


T = int(input())
for i in range(T):
	n = [int(x) for x in input().split(' ')]
	a = min(n)
	b = max(n)
	m = a * b
	while b:
		(a, b) = (b, a % b)
	h = a
	l = m / h
	print(h, int(l))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	gcd_ab = gcd(a, b)
	lcm_ab = a * b // gcd_ab
	print(gcd_ab, lcm_ab)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	print(gcd(a, b), lcm(a, b))


import math
n = int(input())
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	gcd = math.gcd(x, y)
	lcm = int(x * y / gcd)
	print(gcd, lcm)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = math.gcd(a, b)
	d = a * b // c
	print(c, d)


import math
t = int(input())
for i in range(0, t):
	(a, b) = map(int, input().split())
	gcd = math.gcd(a, b)
	lcm = int(a * b / gcd)
	print(gcd, lcm)


import math
T = int(input())
for i in range(T):
	(A, B) = map(int, input().split())
	m = math.gcd(A, B)
	n = A * B // m
	print(m, n)


import math
tc = int(input())
for i in range(tc):
	(x, y) = list(map(int, input().split()))
	gcd = math.gcd(x, y)
	lcm = x * y // gcd
	print(gcd, lcm)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	high = a
	low = b
	while 1:
		r = high % low
		if r == 0:
			break
		else:
			high = low
			low = r
	print(low, a * b // low)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	dup1 = a
	dup2 = b
	while b != 0:
		temp = b
		b = a % b
		a = temp
	gcd = int(a)
	lcm = int(dup1 * dup2 / gcd)
	print(gcd, lcm)