#include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;

int gcd(int x,int y){
  cout << x << ','<<y << endl;
  if(x == 0)return y;
  return gcd(y%x,x);
}

int main(){
  int x,y;
  while(cin >> x >> y){
    int tmp;
    cout << (tmp = gcd(x,y)) << ' '<< (x)*(y/tmp) << endl;
  }
  return 0;
}