Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: 

#include<stdio.h>

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

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>

int gcd(int a, int b){
    while((int remainder = (a % b)) != 0) {
        a = b;
        b = remainder;
    }
    return b;
}

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

int main(){
	long long a, b, c;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a * b / y) << endl;
	}
}

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

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

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

typedef long long int LL;

LL gcd(LL a, LL b) {
  return b != 0 ? gcd(b, a % b) : a;
}
LL lcm(LL a, LL b) {
  return a * b / gcd(a, b);
}

int main(){
	LL a, b;
	while(cin>>a>>b){
		cout<<gcd(a, b)<<" "<<lcm(a, b)<<endl;
	}
	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<iostream>

long int gcd(long int a, long int b){
  long int k;
  if(b>a){
    k=b;
    b=a;
    a=k;
  }
  k = a % b;
  if(k==0){
    return b;
  }
  while(k!=0){
    k = a % b;
    a = b;
    b = k;
  }
  return a;
}

int main(){
  long int a, b, k;

  while(std::cin >> a >> b){
    k = (a*b)/gcd(a,b);
    std::cout << gcd(a,b) << " " << k << std::endl;
  }
}

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

using namespace std;

int main()
{
	unsigned int  a,b;

	while(cin >> a >> b){
		int temp = a<b?a:b;

		int t = temp;
		while((a<b?b:a)%t || (a<b?a:b)%t){
			if(!t)
				break;
			--t;
		}
		cout <<t<<" "<<flush;

		t = a>b?a:b;
		while(true){
			if(!(t%a))
				if(!(t%b))
					break;
			++t;
		}
		cout <<t<<endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

int getGCD(int a, int b) { return b ? getGCD(b, a%b) : a; }
int main() {
	unsigned int a, b, gcd;
	while (cin >> a >> b) {
		gcd = getGCD(a, b);
		cout << gcd << " " << a*b/gcd << endl;
	}
	return 0;
}

C++: //--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.rbegin(),v.rend())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
ll a, b;

inline ll solve() {
	ll now = 2;
	ll ans = 1;
	while (now <= min(a, b)) {
		if (a%now == 0 && b%now == 0) {
			ans *= now;
			a /= now; b /= now;
		}
		else {
			now++;
		}
	}
	return ans;
}

inline ll solve2() {
	ll ans = max(a, b);
	for (ll i = max(a, b); i <= 2000000000; i+=max(a,b)) {
		if (i%a == 0 && i%b == 0) {
			ans = i;
			break;
		}
	}
	return ans;
}


int main() {
	while (cin >> a >> b) {
		cout << solve() << " " << solve2() << endl;
	}
	return 0;
}

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

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

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 < (int)num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

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

	return 0;
}

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

int solve_gcd(int a, int b)
{
	int m,n;
	if(a > b)
	{
		m = a;n = b;
	} else {
		m = b;n = a;
	}

	int r = m%n;
	while(r !=0)
	{
		m = n;
		n = r;
			
		r = m%n;
	}

	return(n);
}

int solve_lcm(int a, int b, int gcd)
{
	long long int c=(long long int)a*b;
	return(c/gcd);
}

int main()
{
	int a,b, gcd, lcm;

	while(cin >> a >> b)
	{
		gcd=solve_gcd(a,b);
		lcm=solve_lcm(a,b,gcd);
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

using namespace std;

int GCD(int m, int n);

int main()
{
	int m, n;
	
	while (cin >> m >> n){
		if (m < n)	swap(m, n);
		
		int gcd = GCD(m, n);
		int lcm = n * (m / gcd);
		
		cout << gcd << ' ' << lcm << endl;
	}	
	return (0);
}

int GCD(int m, int n)
{
	int r;
	while (m % n != 0){
		r = n;
		n = m % n;
		m = r;
    }
	return (n); 
}

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

int main(){
const int INF=1000000;
int a[2];
int GCD,LCM;
while(cin>>a[0]>>a[1]){
for(int i=0;i++;i<INF){
a[0]%=a[1];
if(a[0]==0){
GCD=a[1];
break;}
a[1]%=a[0];
if(a[1]==0){
GCD=a[0];
break;}}
LCM=a[0]*a[1]/GCD;
cout<<GCD<<" "<<LCM<<endl;}}