#include <bits/stdc++.h>
using namespace std;

int main() {
  for(int i = 0; i < 55; i++){
    int a = 0, b = 0, gcd, lcm;
    cin >> a >> b;

    if(a == 0 && b == 0){
      break;
    }
    else{
      int A = max(a, b), B = min(a, b);
      int r = A % B;
      while(r != 0){
        A = B;
        B = r;
        r = A % B;
      }
       gcd = B;

       lcm = gcd * (a / gcd) * (b / gcd);
    }
    cout << gcd << " " << lcm << endl;
  }
}
