#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){

  int a,b;
  int yaku,bai;
  while(cin >> a >> b){
    for(yaku=a;1<yaku;yaku--)
      if(a%yaku==0 && b%yaku==0)
	break;

    for(bai=2;bai<=a;bai++)
      if((bai*b)%a==0){
	bai *= b;
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}