Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include"iostream"
using namespace std;
int max(int a,int b)

{
	if(!b)
	{
		return a;
	}
	return max(b,a%b);
}
int main()
{
	int m,n,temp;
         while (scanf("%d%d", &m, &n) != EOF)
	{
		     
	    	
		 
			if(m>n)
			{
				int a=max(m,n) ;
			printf("%d %d\n",a,n/a*m);
			}
			else
			{
				temp=m;
				m=n;
				n=temp;
				int a=max(m,n);
			printf("%d %d\n",a,n/a*m);
				
			}
		 	
		}
	}

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

#define ULL_INT unsigned long long int

ULL_INT GCD(ULL_INT a, ULL_INT b) {
	if (a < b) swap(a, b);
	a = a % b; return (a == 0 ? b : GCD(a, b));
}

ULL_INT LCM(ULL_INT a, ULL_INT b) {
	return a * b / GCD(a, b);
}

int main() {
	ULL_INT a, b;
	while (cin >> a >> b) 
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	return 0;
}

C++: #include <stdio.h>

int main(){
    int a,b,m,l;
    while(scanf("%d %d",&a,&b)!=EOF){
        m = a%b;
        l = a*b;
        while(m){
            a = b;
            b = m;
            m = a%b;
        }
        printf("%d %d\n",b,l/m);
    }
}

C++: #include <cstdio>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string.h>
using namespace std;
const int INF = 1 << 28;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,start,end) for(int i=(start);i<(end);++i)
#define pint(i) printf("%d\n",(i))
#define pint2(i,j) printf("%d %d",(i),(j))
#define pint3(i,j,k) printf("%d %d %d",(i),(j),(k))
#define gint(i) scanf("%d",&(i))
#define gint2(i,j) scanf("%d %d",&(i),&(j))
#define gint3(i,j,k) scanf("%d %d %d",&(i),&(j),&(k))
#define init(tar,val) memset((tar),(val),sizeof((tar)))
#define show(tar,len) for(int i=0;i<(len);++i) \
	cout<<tar[i]<<' ';\
	cout<<endl;


/*

class bignum{
public:
	bignum(int size = 4) :len(size){
	}
	~bignum(){
	}
	int size()const{
		return len;
	}
	//int get(int id)const{
	//	return num[id];
	//}
	friend ostream &operator<<(ostream &output, const bignum &b){
		bool stu = false;
		for (int i = int(b.len - 1); i >= 0; --i){
			if (stu)
				printf("%09d", b.num[i]);
			else if (b.num[i] > 0){
				printf("%d", b.num[i]);
				stu = true;
			}
		}
		if (stu == false)
			printf("0");
		return output;
	}
	const bignum& operator+=(const bignum&right){
		int add = 0;
		for (int i = 0; i < len; ++i){
			int tmp = 0;
			if (i < right.size()){
				tmp = right.num[i] + num[i] + add;
			}
			else{
				tmp = num[i] + add;
			}
			num[i] = tmp%gap;
			add = tmp / gap;
		}
		return *this;
	}
	const bignum& operator=(const bignum&right){
		for (int i = 0; i <len; ++i){
			num[i] = right.num[i];
		}
		return *this;
	}
	void set(int a){
		for (int i = 0; i <len; ++i){
			num[i] = a%gap;
			a /= gap;
		}
	}
private:
	int  num[4];
	int len;
	static const int gap = 1000000000;
};

//int gcd(int a,int b){
//	if(b==0)
//		return a;
//	return gcd(b,a%b);
//}
//
////a*x+b*y=gcd(a,b);
//int extgcd(int a,int b,int &x,int &y){
//	int d=a;
//	if(b!=0){
//		d=extgcd(b,a%b,y,x);
//		y-=(a/b)*x;
//	}
//	else{
//		x=1,y=0;
//	}
//	return d;
//}


//inline int id(int i){
//	return i & 1;
//}
//
//inline int last(int i){
//	return (i - 1) & 1;
//}
//
//void myshow(int i){
//	rep(j, 0, ){
//		cout << dp[id(i)][j] << ' ';
//	}
//	cout << endl;
//}

//int n_stu[MAX_N];
//void n_init(){
//	rep(i, 0, n)
//		n_stu[i] = i;
//}
//int n_getf(int id){
//	if (n_stu[id] != id){
//		n_stu[id] = n_getf(n_stu[id]);
//	}
//	return n_stu[id];
//}
//bool n_same(int i, int j){
//	if (n_getf(i) == n_getf(j))
//		return true;
//	return false;
//}
//void n_union(int i, int j){
//	int fi = n_getf(i), fj = n_getf(j);
//	if (fi != fj){
//		n_stu[fi] = fj;
//	}
//}


*/
#define my_debu



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

ll lcm(ll a, ll b, ll gcd){
	return a / gcd*b;
}

int main(){
#ifdef my_debug
	freopen("a.in", "r", stdin);
#endif
	ll a, b;
	while (scanf("%lld %lld",&a,&b)!=EOF){
		ll tmp = gcd(a, b);
		printf("%lld %lld\n", tmp, lcm(a, b, tmp));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    long long a, b, r, g, l;
    while(cin >> a >> b){
        l = a*b;
        if(a < b) swap(a,b);
        do{
            r = a % b;
            a = b;
            b = r;
        }while(r);
        g = a; l /= g;
        cout << g <<' '<<l <<endl;
    }
    return 0;
}

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

long GCD(long a, long b){
	if(b == 0) return a;
	else return GCD(b, a%b);
}

long LCM(long a, long b){
	return a*b / GCD(a, b);
}

int main()
{
	long a,b;
	while(cin >> a >> b){
		cout << GCD(a,b) << " " << LCM(a,b) << endl;
	}
}

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

int main() {
	long a,b,G;
	cin>>a>>b;
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
}

C++: #include <iostream>
 
 
using namespace std;
 
int main() {
 
    long ain,bin;
    long c,d,e,gcm,lcd;
     
    cin >> ain >> bin;
    if (ain < bin) {
        c = ain;
        ain = bin;
        bin = c;
        c=0;
    }
 
    c=ain;
    d=bin;
 
    for(;;) {
        if(d==0) {
            gcm = c;
            lcd = ain * bin / gcm;
            break;
        }
        e = c % d;
        c = d;
        d = e;
    }
 
    cout << gcm << " " << lcd << endl;
 
 
    return 0;
}

C++: 
#include <stdio.h>

int main(){
    long a, b, r, lcm, x, y;
    while (scanf("%ld %ld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%-ld %-ld\n",y,lcm);
    }
    
    return 0;
}

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

for(i=1;i<=small;i++){//最小公倍数

if((big*i)%small==0){
koubai=big*i;
break;
}
}

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    long long int flag,a1,b1,t,k,a,b;
    while(cin>>a>>b){
		if(a==b){
			cout<<'1'<<" "<<a<<endl;
			continue;
		}
    	a1=a,b1=b;
		if(a<b)
			t=a,a=b,b=t;
		k=a%b;
		while(k){
			a=b;
			b=k;
			k=a%b;
		}
		cout<<b<<" "<<(a1/b)*b1<<endl;
    }
}

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

//aとbの最大公約数と最小公倍数を求める。
void Euclidean(const long a, const long b, long& divisor, long& multiple);

int main(void) {
    long a, b;
    long divisor, multiple;
    
    while(cin >> a >> b) {
        Euclidean(a, b, divisor, multiple);
        cout << divisor << ' ' << multiple << endl;
    }
}

void Euclidean(const long a, const long b, long& divisor, long& multiple) {
    long L, S, n;
    if(a > b) { L = a;   S = b; }
    else      { L = b;   S = a; }
    while((L % S) != 0) {
        n = L;
        L = S;
        S = n % S;
    }
    divisor = S;
    multiple = a * b / divisor;
}

C++: #include <iostream>
//include <algorithm>
using namespace std;
int gcd( int a, int b ){
	if( b == 0 ){
		return a;
	}else{
		return gcd( b, a % b );
	}
}
int lcm( int a, int b ){
	return ( a / gcd( a, b ) ) * b;
}
int main(){
	int a, b;
	while( cin >> a >> b ){
		cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
	}
}