#include <iostream>
#include <vector>

std::pair<unsigned int, unsigned int> solve(unsigned int a, unsigned int b){
	std::pair<unsigned int, unsigned int> ans;
	std::vector<unsigned int> divs;
	unsigned int n = 2;

	while(true){
		if( a < n || b < n ) break;
		if(	a % n == 0 &&
			b % n == 0){
			divs.push_back(n);
			a /= n;
			b /= n;
			n = 2;
		}else{
			n++;
		}
	}

	ans.first = 1;
	for(unsigned int n : divs){
		ans.first *= n;
	}

	ans.second = ans.first*a*b;

	return(ans);
}

int main(){
	std::vector<std::pair<unsigned int, unsigned int>> ans;

	unsigned int a,b;
	while(true){
		std::cin >> a >> b;
		if(std::cin.eof()) break;
		ans.push_back(solve(a,b));
	}

	for(auto&& a : ans){
		std::cout << a.first << " " << a.second << std::endl;
	}
	
}