#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long a,b,yakuans,baians;
	while(cin>>a>>b){
		if(a>b)swap(a,b);
		for(int i=2;i<=a;i++){
			if((a/i)*i==a){
				if((b/i)*i==b){
					yakuans=i;
				}
			}
		}
		baians=(a*b)/yakuans;
		cout<<yakuans<<" "<<baians<<endl;
	}
	return 0;
}