#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>

int gcd(int a, int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x,y,z,lcm;
while(x!=0||y!=0){
scanf("%d%d",&x,&y);
z=gcd(x,y);
lcm=(x*y)/z;
printf("%d %d\n",z,lcm);
}
return 0;
}