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++: #include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define p pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<d;
#define OUTL(d) cout<<d; BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))
 
ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x%y);
}

ll lcm(ll x, ll y){
    return x * (y / gcd(x, y));
}

signed main(){ INIT;
    ll x, y;
    while(cin >> x){
        cin >> y;
        OUT(gcd(x, y)); SP; OUTL(lcm(x, y));
    }
RET;}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(long long a,long long b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		if(b>a) swap(a,b);
		long long t=gcd(a,b);
		cout<<t<<' '<<a/t*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % (minimum - i + 2) == 0 && b % (minimum - i + 2) == 0) {
                i = minimum - i + 2;
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #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(scanf("%d%d",&a,&b) != EOF){
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);
  }

  return 0;
}

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

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

int main()
{
    int a, b;

    while (cin >> a >> b) {
        int c = gcd(a, b);
        cout << c << " " << a/c*b << endl;
    }
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
class GCDandLCM{
    public:
        void solve(long a,long b){
            long big=a,small=b;
            if(a<b){ 
                big=b;
                small=a;
                int tmp=a;
                a=b;
                b=tmp;
            }
            while(big%small!=0){ 
                int tmp=big%small;
                big=small;
                small=tmp;
            }
            printf("%ld %ld\n",small,(a*b)/small);
        }
};
int main(){ 
    GCDandLCM inst;
    long a,b;
    while(cin>>a>>b){ 
        inst.solve(a,b);
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
typedef unsigned long long int ll;

using namespace std;

ll Euclid(ll m, ll n){
    if(n == 0)  return m;
    else        return Euclid(n, m % n);
}

int main(){
    ll gcd;    //the greatest common divisor
    ll lcm;    //least common multiple
    ll m, n, tmp;
    while (cin >> m >> n){
        if(m < n){
            tmp = m;
            m = n;
            n = tmp;
        }
        gcd = Euclid(m, n);
        lcm = m * n / gcd;
        cout << gcd << " " << lcm << endl;
    }
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int  i,a,b,c,x,y;
	
	scanf("%d %d",&a,&b);
	x=a;	y=b;
	if(a<b){
	    c=a;
		a=b;
		b=c;
	}
	c=a%b;
	while(c!=0){
	    a=b;
		b=c;
		c=a%b;
	}
	i=x/b*y;
	printf("%d %d\n",b,i);
	return 0;
}

C++: #include <iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){

        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
main(){
	int n1,n2,a1,a2;
	while(cin>>n1>>n2){
		int mx=max(n1,n2);
		for(int i=mx;i>0;--i){
			if(n1%i==0 && n2%i==0){
				a1=i;
				break;
			}
		}
		a2=(n1/a1)*n2;
		cout<<a1<<" "<<a2<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		long long a, b;
		cin >> a >> b;
		if ( cin.eof() )
			break;

		long long x = max(a,b);
		long long y = min(a,b);

		while ( y > 0 )
		{
			x -= y;
			if ( x < y )
				swap( x, y );
		}

		long long gcd = x;
		long long lcm = a*b / gcd;

		cout << gcd << " " << lcm << endl;

	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include<math.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

ll gcd(ll a,ll b){
if(b==0){
    return a;
}
else{
   return gcd(b,a%b);
}
}
 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/

ll a,b;
while(cin>>a>>b){

cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;


}
}