Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

C++: /*
 * fudq.cpp
 *
 *  Created on: 2015-10-24
 *      Author: bjfudq
 */
#include <functional>
#include <algorithm>
#include <iostream>
//#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,102400000")


#define MEM(a) (memset((a),0,sizeof(a)))
#define LEN(a) (int)strlen((a))
#define fr(a) for(int i=0;i<(a);i++)
#define sf(a) scanf("%d",&(a))
#define sf64(a) scanf("%I64d",&(a))
#define sff(a) scanf("%lf",&(a))
#define sfs(a) scanf("%s",(a))
#define sf2(a,b) scanf("%d%d",&(a),&(b))
#define sf3(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
#define sf2s(a,b) scanf("%s%s",(a),(b))
#define sf2f(a,b) scanf("%lf%lf",&(a),&(b))
#define sf3f(a,b,c) scanf("%lf%lf%lf",&(a),&(b),&(c))
#define sf264(a,b) scanf("%I64d%I64d",&(a),&(b))
#define sf364(a,b,c) scanf("%I64d%I64d%I64d",&(a),&(b),&(c))
#define pf(a) printf("%d\n",(a))
#define pfc(a) printf("%c",(a))
#define pf64(a) printf("%I64d\n",(a))
#define pff(a) printf("%lf\n",(a))
#define pfs(a) printf("%s\n",(a))
#define pf2(a,b) printf("%d %d\n",(a),(b))
#define pf2s(a,b) printf("%s%s\n",(a),(b));
#define pf2f(a,b) printf("%lf %lf\n",(a),(b))
#define pf264(a,b) printf("%I64d %I64d\n",(a),(b))
#define pfn printf("\n")
#define pfk printf(" ")
#define LL long long

const int N=1000010;
const int M=1000010;
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const int dir4[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
const int dir8[8][2]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
const double eps=1e-12;
const double PI=acos(-1.0);

inline int sign(double x){return (x>eps)-(x<-eps);}
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
/*************************/



int main(){
    LL a,b;
    while(sf264(a,b)!=EOF){
    	LL g=gcd(a,b);
    	pf264(g,a/g*b);
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	long long a,b,c,d,e;
	std::cin>>a>>b;
    d=a;
	e=b;	
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	std::cout<<a<<" "<<(d*e)/a;
}

C++: #include <iostream>
#include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return gcd( b, a % b );
}


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << a/g*b << endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>

using namespace std;
#define EPS 1e-9
#define MAX 505
#define pb push_back
#define mp make_pair
#define ins insert
#define fi first
#define se second
#define pi acos(-1.0)
#define mod 100000007
#define inf 2147483647
#define ll long long int
#define sss stringstream
#define oss ostringstream
#define iss istringstream
#define llu long long unsigned

#define _sq(a) (a)*(a)
#define sz(a) ((int)a.size())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b) ((a)*((b)/gcd(a,b)))
#define _max3(a,b,c) max(a, max(b,c))
#define _min3(a,b,c) min(a, min(b,c))
#define FOR(i, n) for(i=0; i<(int)n; i++)
#define FOR1(i, n) for(i=1; i<=(int)n; i++)
#define mem(a) memset(a, 0, sizeof(a))
#define _set(a) memset(a,-1,sizeof(a))
#define FORI(i, a, b) for(i=a; i>=(int)b; i--)
#define FORab(i, a, b) for(i=a; i<=(int)b; i++)
#define popcount(n) __builtin_popcount(n)
#define popcountl(n) __builtin_popcountll(n)
#define sort_rev(a) sort(a.rbegin(), a.rend())
#define sort_all(a) sort(a.begin(), a.end())
#define dis_twopoints(x1,y1,x2,y2) sqrt(_sq(x1-x2) + _sq(y1-y2))
#define foreach(i,n) for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)

//If Long Long (mask & (1LL << k))
#define check(mask, k) (mask & (1 << k))
#define set1(mask, k) (mask | (1 << k))
#define set0(mask ,k) (mask & (~(1<<k)))

#define SD(a) scanf("%d",&a)
#define SLF(a) scanf("%lf",&a)
#define SC(a) scanf("%c",&a)
#define SS(a) scanf("%s",a)
#define SLLD(a) scanf("%lld", &a)
#define Si64(a) scanf("%I64d", &a)

#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
int main()
{
    unsigned long long int a,b,n,t,r,gcd,lcm;
    while(cin>>a>>b)
    {
        r=1;
        n=a*b;
        if(b>a)
        {
            t=a;
            a=b;
            b=t;
        }
        while(r!=0)
        {
            r=a%b;
            a=b;
            b=r;
            gcd=a;
        }
        if(a==b)
        {
            gcd=a;
        }
        lcm=n/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;

int gcd(int m, int n){
	if(m == 0 || n == 0)return 0;
	while(m != n){
		if(m > n)m -= n;
		else n -= m;
	}
	return m;
}

int main(){
	int m, n;
	while(cin >> m >> n){
		int x = gcd(m, n);
		cout << x << " " << m / x * n << endl;
	}
    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __lcm(n, m));
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main(void) {
    int a,b;
    int d,m;
    while (1){
        cin >> a;
        if (cin.eof())
            break;
        cin >> b;
        int l=max(a,b);
        int s=min(a,b);
        int n;
        while (1){
            n=l%s;
            if (n==0){
                d=s;
                break;
            }
            l=s;
            s=n;
        }
        m=a*(b/d);
        cout << d << " " << m << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	long int gcd[200],num1,num2,lcm[200];
	int a,b;
	int i=0;
	
	while(cin >> a >> b){
		num1 = a;
		num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (gcd[i]=num1%num2) != 0){
			num1 = num2;
			num2 = gcd[i];
		}
		gcd[i] = num2;
		lcm[i] = a / gcd[i] * b;
		i++;
	}
	
	for(int j=0; j<i; j++)
		cout << gcd[j] <<" "<< lcm[j] << "\n";
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

long long a,b;
long long GCD(long long a,long long b)
{
    long long d;
    while(b != 0)
    {
        d = a%b;
        a = b;
        b = d;
    }
    return a;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        long long gcd = GCD(a,b);
        long long p = a/gcd,q = b/gcd;
        long long lcm = p*q*gcd;
        cout<<gcd<<" "<<lcm<<"\n";

    }
    return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int gcd(int a,int b);

int main(){
	int a,b,c;
	while(cin >> a >> b){
		c = gcd(a,b);
		printf("%d %d\n",c,a/c*b);
	}


	return 0;
}

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