main(){
  unsigned int i,j,a,b;
  while(scanf("%d %d",&a,&b)!=-1){
    if(a<b){
      //for(i=1;b%(a/i);for(;a%i;i++))
	//;
      for(i=a;a%i||b%i;i--);
      for(j=i;j%b;j+=i);
    }else{
      for(i=b;a%i||b%i;i--);
      for(j=i;j%a;j+=i);
    }
    printf("%d %d\n",i,j);
  }
  return 0;
}