#include<stdio.h>

int gcd(int one, int two){		//Ååöñ
	
	int temp,mod;
	
	if(one<two){
		temp=one;
		one=two;
		two=temp;
	}
	
	while(1){
		
		if(two==0){
			return one;
		}
		
		else{
			mod=one%two;
			one=two;
			two=mod;
		}
	}
}


int lcm(int one, int two){		//Å¬ö{
	
	int r;
	
	r=(one*two)/gcd(one,two);
	
	return r;
}
	
int main(void){

	int first,second;
	int j,k;

	while(1){
		
		scanf("%d %d",&first,&second);
		
		if(first==0||second==0){
			break;
		}
	
		j=gcd(first,second);
		k=lcm(first,second);

		printf("%d %d\n",j,k);
	}
	
	return 0;
}