#include<iostream>

int main(){
	int a[44722],b,c,d,e=0,f=1;
	while(std::cin >> b >> c){
	for(d=2;d*d<=b||d*d<=c;){
		if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
		}else break;
	}
	for(d=3;d*d<=b||d*d<=c;d=d+2){
		while(1){
			if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
			}else break;
		}
	}
	a[e] = 0;
	for(e=0;a[e]>0;e++){
		f = f * a[e];
	}
	std::cout << f;
	f = f * b * c;
	std::cout << " " << f << std::endl;
	e = 0;
	f = 1;
	}

	return 0;
}