#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>


using namespace std;

#define Max INT_MAX
#define Inf (INT_MAX/2)
#define Min INT_MIN


#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
// s <= x < g ?
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
// 0 <= x < w && 0 <= y < h ?
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

typedef pair<int, int> P;
typedef long long ll;



int gcd( ll a, ll b) {
    if( b == 0) { return a; }
    if( a > b ) { return gcd(b, a%b); }
    if( b > a ) { return gcd(a, b%a); }
}


int main()
{
    int n;
    while ( 1 ){
        int a,b;
        cin >> a >> b;
        if( a == 0 && b == 0 ) { break; }
        ll G = gcd(a,b);
        cout << G << " " << a * (b / G) << endl;
        //cout << lcm(a,b) << " " << gcd << endl;
    }
}