testCase = Array.new
i = 0
STDIN.each_line do |line|
  testCase[i], testCase[i+1] = line.split(" ").map(&:to_i)
  i += 2
end
i = 0
testCase.length/2.times do
  print testCase[i].gcd(testCase[i+1])
  print " "
  puts testCase[i].lcm(testCase[i+1])
  i += 2
end