#!/usr/bin/env ruby
# encoding: utf-8

def gcd ( a, b )
	n, i = 0, 1
	tmp = []
	if a > b
		tmp << a << b << 0
	else
		tmp << b << a << 0
	end
	while true
		while true
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i
			if tmp[( n + 2 ) % 3 ] == 0
				return tmp[( n + 1 ) % 3 ]
			elsif tmp[( n + 2 ) % 3 ] < tmp [( n + 1 ) % 3 ]
				break
			end
			i += 1
		end
		n += 1
	end
end

while line = gets do
	c, d = line.split.map(&:to_i)
	g = gcd c, d
	l = ( c / g ) * d
	puts "#{g} #{l}"
end