#include <iostream>
using namespace std;

int main(){
  int a, b, c, d, tmp;
  while(cin >> a >> b){
     if(a < b){
       tmp = a;
       a = b;
       b = tmp;
     }
//?????§??¬?´???°
     for(int i = 1;i <= b;++i){
        if(a % i == 0 && b % i == 0)
          c = i;
     }
//????°???¬?????°
     while(1){
        int i = a;
        d = i;
        if(a % d == 0 && b % d == 0) break;
        a++;
     }
  }
  cout << c << " " << d << endl;
  return 0;
}