def find_gcd(a, b):
while b:
a, b = b, a % b
return a
def find_lcm(a, b):
return a * b // find_gcd(a, b)
def calculate_lcm_gcd():
num_tests = int(input())
for _ in range(num_tests):
a, b = map(int, input().split())
lcm_num, gcd_num = find_lcm(a, b), find_gcd(a, b)
print(lcm_num, gcd_num)
calculate_lcm_gcd()