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++: /********************************************************************
 * ??£?????´??° a,b ?????\?????????a ??¨ b ????????§??¬?´???°??¨????°???¬?????°???????????????
 * ????????°?????????????????????????????????
 ********************************************************************/
#include <iostream>
#include <cstring>
typedef struct _input_values {
    int a;
    int b;
} INPUT_VALUES;

typedef struct _input_values_list {
    INPUT_VALUES sList[10000];
    int effectCount;
} INPUT_VALUES_LIST;

int gcd( int a, int b );    // ?????§??¬?´???°????±???????
int lcm( int a, int b, int g );    // ????°???¬?????°????±???????

using namespace std;

int main()
{
    int i = 0;
    int tA = 0, tB = 0;
    int g = 0, l = 0;
    INPUT_VALUES_LIST values;

    memset( &values, 0, sizeof(values) );

    while( cin >> tA >> tB ) {
        values.sList[values.effectCount].a = tA;
        values.sList[values.effectCount].b = tB;
        values.effectCount++;
    }

    for ( i = 0; i < values.effectCount; i++ ) {
        g = gcd( values.sList[i].a, values.sList[i].b );
        l = lcm( values.sList[i].a, values.sList[i].b, g );
        cout << g << " " << l << endl;
    }

    return 0;
}

/*  @brief  ?????§??¬?´???°????±???????
 *  @param  [i] a   ???????????????
 *  @param  [i] b   ???????????????
 *  @retval ?????§??¬?´???°
 */
int gcd( int a, int b )
{
    int ret = 0;

    if ( 0 == a || 0 == b ) {
        return 0;
    }

    if ( a != b ) {
        if ( a > b ) {
            a = a - b;
        } else {
            b = b - a;
        }
    } else {
        return a;
    }

    ret = gcd( a, b );

    return ret;
}

/*  @brief  ????°???¬?????°????±???????
 *  @param  [i] ???????????????
 *  @param  [i] ???????????????
 *  @param  [i] ?????§??¬?´???°
 *  @retval ????°???¬?????°
 */
int lcm( int a, int b, int g )
{
    if ( 0 == a || 0 == b ) {
        return 0;
    }

    return ( a * b / g );
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y){
		cout<<__gcd(x,y)<<' '<<x/__gcd(x,y)*y<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int f(int a,int b){
     int n;
     n=a%b;
   return n;
}
int main(){
    int a,b,c,d,x,y,z;
    while(cin>>x>>y){
    a=x;
    b=y;
      for(d=0;c>0;d++){
         c=f(a,b);
         a=b;
         b=c;
    }
    z=x*y/a;
    cout<<a<<" "<<z<<endl;
    }
         return 0;
}

C++: #include <stdio.h>

int main(){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < nCount;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

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

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

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
	
		if(cin.eof())
			break;
	
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

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

typedef long long ll;

ll GCD(ll x, ll y) {
  if (x < y) swap(x, y);

  return y == 0 ? x : GCD(y, x % y);
}

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

int main()
{
  int a, b;

  while (scanf("%d%d", &a, &b) != EOF) {
    ll gcd = GCD(a, b);
    printf("%lld %lld\n", gcd, LCM(a, b, gcd));
  }
  
  return 0;
}

C++: //----- ユークリッドの互除法を行う関数 -----//

int f_kouyakusuu(int , int , int*);

//----- 最小公倍数を求める関数 -----//

int f_koubaisuu(int , int , int*);


//*****----- main -----*****//

int main(void)
{
	//入力変数2つ
	int x = 0 , y = 0;
	//公約数と公倍数は保存しておかなければならない
	int kouyakusuu = 0 , koubaisuu = 0;

	while (scanf("%d %d" , &x , &y) != EOF)
	{
		koubaisuu = f_koubaisuu(x , y , &kouyakusuu);
		printf("%d %d\n" , kouyakusuu , koubaisuu);
	}

	return 0;
}




//*****----- ユークリッドの互除法を利用する関数 -----*****//

int f_kouyakusuu(int x , int y , int *kouyakusuu)	//最初ｘ＜ｙでもforによって入れ替えられる
{
	//保存変数
	int hozon = 0;

	//割って0になるまで
	while ((hozon = x % y) != 0)
	{
		x = y;
		y = hozon;
	}

	//公約数を保存する
	*kouyakusuu = y;
	//最後に割ったｘを返す
	return y;
}



//*****----- 最小公倍数を求めるプログラム *****-----//

int f_koubaisuu(int x , int y , int *kouyakusuu)
{
	//最初に計算して値を小さくする
	int modoriti = f_kouyakusuu(x , y , kouyakusuu);
	//値がでかいので工夫
	unsigned long long int hozon = x * y;
	hozon = x / modoriti;
	//計算して値を返す
	return hozon * y;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 1;
	while (cin >> a, cin >> b)
	{
		int w = a;
		int x = b;
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i * c;
				a = a / i;
				b = b / i;
				i = 1;
			}
		}
		cout << c <<" "<< w * x / c << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

int main(){
    typedef unsigned long long ull;
    ull a,b; cin>>a>>b;
    cout << __gcd(a,b) << " ";
    cout << a*b/__gcd(a,b) << endl;
}

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

C++: #include<stdio.h>
int main(){
  long 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/b);
  }
}

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<<" "<<((e/a)*(d/a)*a);
}

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 == 1) i = 1;
    for(i == 2;i <= minimum; i++){
        if(a % i == 0 && b % i == 0) break;
    }
    return i;
}

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

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