#include<iostream>
using namespace std;

int main(){
	long long int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	for(int j=0;j<nn;j+=2){
		long long int gcd=0,lcm=0;
		for(long long int k=1;k<n[j]+n[j+1];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		long long int a=0,b=0;
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}