Signal.trap(:INT){
  exit(0)
}

base_arr = Array.new(50000, true)
base_arr[0] = false #
base_arr[1] = false # how to write cooler these.

# make prime array
i = 2
50000.times do
	if base_arr[i] == true
 		for j in (2..50000) do
 			if i*j < 50000
				base_arr[i*j] = false
			else
		 		break 
			end
		end
	end
	i += 1
end

def prime_dec(x, base_arr) 
	#if x is not prime number, x can devide less than root x
	prime_arr = [1]
	#tmp = Math.sqrt(x).to_i
	50000.times do |i|
		#make prime deconposition
		if base_arr[i] == true
			tmp = Math.sqrt(x).to_i
			tmp.times do |j|
				break if x == 1
		
				if (x % i) == 0
					prime_arr.push i
					x /= i
					redo
				end
			end
		end
	end
	prime_arr.push x
	return prime_arr
end
while str = gets
	nums = str.split(" ")
	num0 = nums[0].to_i
	num1 = nums[1].to_i

	arr0 = prime_dec(num0, base_arr)
	arr1 = prime_dec(num1, base_arr)

	gcd = 1
	gcd_arr = arr0 && arr1
	gcd_arr.size.times do |i|
	 gcd *= gcd_arr[i]
	end
	puts "#{num0.gcd(num1)} #{num0.lcm(num1)}"
end