data = Array.new()
i = 0
ans = Array.new()
while true
	data[i] = gets
	break if data[i] == nil
	data[i] = data[i].split(" ")
	ans[i] = data[i][0].to_i.gcdlcm(data[i][1].to_i)
	i += 1
end
i.times do |i|
	puts "#{ans[i][0]} #{ans[i][1]}"
end