#include<iostream>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    les=b%bet;
    if(les==0)
      max=bet;
    else{
    for(int i=1;i<=bet;i++){
      if(bet%i==0)
	ayaku.push_back(i);
    }
    for(int i=1;i<=les;i++){
      if(les%i==0)
	byaku.push_back(i);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&ayaku[i]>max)
	  max=ayaku[i];
      }
    }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}