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>
#include<algorithm>
using namespace std;

int main(){
	long long  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		b=tmp%a;
		if(a<b){
		b=1;
		break;
		}
		if(a%b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b,r,G,R,L,tmp;
  while(cin >> a >> b){
    R = a; L = b;
    if(b > a){
      a = tmp; a = b; b = tmp;
    }
    while(1){
	  r = a % b;
	  if(r == 0)
	    break;
	  a = b;
	  b = r;
	   }
    G = b;
    R = R / G;
    L = L / G;
    cout << G <<" "<< R*L*G << endl;
  }
}

C++: include<stdio.h>


//公約数の関数
unsigned long long int kouyakusuu_f(unsigned long long int a,unsigned long long int b)
{
	//返す変数
	unsigned long long int kouyakusuu_ans = 0;

	//無限ループ
	for (unsigned long long int i = a;;i -= 2)
	{
		//両方割れるなら
		if (a %i == 0)
		{
			if (b % i == 0)
			{
				kouyakusuu_ans = i;
				break;
			}
		}
	}

	return kouyakusuu_ans;
}



//公倍数の関数
unsigned long long int koubaisuu_f(unsigned long long int a,unsigned long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	unsigned long long int hozon1 = a,hozon2 = b;
	//インクリメント変数
	int count1 = 0,count2 = 0;

	//合うまで続ける
	while (hozon1 != hozon2)
	{
		//aのほうが小さいとき(bが大きい)
		while (hozon1 < hozon2)
		{
			count1++;
			//小さいaを少しずつ増やす
			hozon1 = a * count1;
		}
		//bの方が小さいとき(aが大きい)
		while (hozon2 < hozon1)
		{
			count2++;
			//小さいbを少しずつ増やす
			hozon2 = b * count2;
		}
	}

	//どうせ同じだからどっちでも問題ない
	return hozon1;
}




int main(void)
{
	//公倍数と公約数
	unsigned long long int kouyakusuu = 0;
	unsigned long long int koubaisuu = 0;
	//入力
	unsigned long long int a = 0,b = 0;

	//回しまくる
	while (scanf("%d %d",&a,&b) != EOF)
	{
		//同じ値ならそのマンまでいいでしょう
		if (a != b)
		{
			//公約数を関数よりもとめる
			kouyakusuu = kouyakusuu_f(a,b);
			//公倍数を関数により求める
			koubaisuu = koubaisuu_f(a,b);
		}
		//同じ値ならそのまま
		else
		{
			koubaisuu = a;
			kouyakusuu = a;
		}
		//表示
		printf("%llu %llu\n",kouyakusuu,koubaisuu);
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,x,y,r;
	cin>>a>>b;
	x=a;	y=b;
	while(1){
		if(b>a)	swap(a,b);
		r=a%b;
		if(r==0)	break;
		a=b;
		b=r;
	}
	cout<<b<<" "<<x*y/b<<endl;
	return 0;
}

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

int get_gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int a, b;
  while (cin >> a >> b) {
    int gcd = get_gcd(a, b);
    int lcm = a / gcd * b;
    cout << gcd << " " << lcm << endl;
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

typedef unsigned long long ull;

ull gcd(ull a, ull b) {	// 最大公約数
	//while ((a = a % b) != 0) swap(a, b);
	ull r;

	while ((r = a % b) != 0) {
		//if (r > b - r) r = b - r;
		a = b;
		b = r;
	}

	return b;
}

ull lcm(ull a, ull b) {	// 最小公倍数
	return a * b / gcd(a, b);
}

int main() {
	ull a, b;

	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}

	return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main(){
    ll A,B;
    ll a,b;
    ll t1,t2;
    while( cin>>a>>b ){
        A=a;B=b;
        if(a<b)swap(a,b);
        while(1){
            t1=b;
            t2=a%b;
            a=t1,b=t2;
            if(b==0){
                cout<<a<<" "<<A*B/a<<endl;
                break;
            }
        }
    }
}

C++: #include <iostream>

#define ll long long

using namespace std;

ll gcd(ll x, ll y) {
 ll r;
 
 while(y != 0) {
  r = x % y;
  x = y;
  y = r;
 }

 return x;
}

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

int main() {
 ll a, b;

 while(cin >> a >> b) {
  cout << gcd(a, b) << " " << lcm(a, b) << endl;
 }

 return 0;
}

C++: #include <cstdio>

using namespace std;

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

int main(){
    int a, b,gcd;
    long int lcm;
    while(true){
        scanf("%d%d",&a,&b);
        gcd = gcdr(a,b);
        //printf("%d\n",gcd);
        lcm = (long)a * b / gcd;
        printf("%d %ld\n",gcd,lcm);
    }
    
    return 0;
}

C++: #include<iostream>
int e(int a,int b){if(a<b)a^=b^=a^=b;return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",c,a*b/c))c=e(a,b);}

C++: #include<iostream>
using namespace std;
int main(){
  long int sn = 0;
  long int bn = 0;
  long int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0){
      lcm = i;
      break;
    }
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0){
      gcd = i;
      break;
    }
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int a,b,ta,tb,tc;
	while(cin >> a>>b){
		ta=a;
		tb=b;
		while(1){
			if(ta<tb){
				tc=ta;
				ta=tb;
				tb=tc;
			}
			tc=ta%tb;
			if(tc==0)break;
			ta=tb;
			tb=tc;
		}
		cout << tb<< " "<< a/tb*b <<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int  i,a,b,c,x,y;
	
	while(scanf("%d %d",&a,&b)!=EOF){
		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++: //
//  main.cpp
//  gcd
//
//  Created by Syngnath on 15/12/16.
//  Copyright ? 2015年 Syngnath. All rights reserved.
//
#include <iostream>
#include <cstdio>

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

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

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	long a,b,G;
	while (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 <cstdio>

#define INT unsigned long

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

INT lcm(INT a, INT b)
{
  INT tmp = gcd(a, b);
  /* gcd(a, b) * lcm(a, b) = a * b */
  return tmp ? a * b / tmp : 0;
}

int main(void)
{
  INT a, b;
  
  while (std::scanf("%ld %ld\n", &a, &b) != EOF) {
    std::printf("%ld %ld\n", gcd(a, b), lcm(a, b));
  }

  return 0;
}

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

int euclid_alg(const int a, const int b) {
	return a % b;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i+1],num[i]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}