#include<iostream>
using namespace std;

int main(){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b >>;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i = a;
		a = b;
		b = i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i = a;
 a = b;
 b = i;
 }
}
cout >> g >> " " >> seki / g >> endl;

    return 0;
}