#include<stdio.h>
#include<iostream>
using namespace std;
int gcd(int x,int y){
	int work=0,first=1,answer=0;
	if(x<=y){
		work=x;
		x=y;
		y=work;
	}
	while(1){
		first=x%y;
		if(first==0){
			answer=y;
			return answer;
		}
		x=y;
		y=first;
	}
}
int main(void)
{
	int a=0,b=0;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		else{
			cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;
		}
	}
	return 0;
}
