#include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(i>50){
cin>>a>>b;
if(a==0 || b==0){cout<<0<<" "<<0<<endl;}
x=a;y=b;
while(1){
  if(x<y){y-x;}
  else if(x>y){x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
if(a!=0 || b!=0){cout<<g<<" "<<L<<endl;}
  ++i;
}
  return 0;
}