#include <iostream>
using namespace std;
int main() {
	int a,b,e,f;
	while(cin>>a>>b){
		int l=0;
		e=a;
		f=b;
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(f==e) break;
		cout<<l<<" "<<(a*b)/l<<endl;
	    }
	return 0;
}