Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

int gcd(int m, int n){
	if(m == 0 || n == 0)return 0;
	while(m != n){
		if(m > n)m -= n;
		else n -= m;
	}
	return m;
}

int main(){
	int m, n;
	while(cin >> m >> n){
		int x = gcd(m, n);
		cout << x << " " << m / x * n << endl;
	}
    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __lcm(n, m));
    }
    return 0;
}

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

int main(void) {
    int a,b;
    int d,m;
    while (1){
        cin >> a;
        if (cin.eof())
            break;
        cin >> b;
        int l=max(a,b);
        int s=min(a,b);
        int n;
        while (1){
            n=l%s;
            if (n==0){
                d=s;
                break;
            }
            l=s;
            s=n;
        }
        m=a*(b/d);
        cout << d << " " << m << endl;
    }
    return 0;
}

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

int main(){
	long int gcd[200],num1,num2,lcm[200];
	int a,b;
	int i=0;
	
	while(cin >> a >> b){
		num1 = a;
		num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (gcd[i]=num1%num2) != 0){
			num1 = num2;
			num2 = gcd[i];
		}
		gcd[i] = num2;
		lcm[i] = a / gcd[i] * b;
		i++;
	}
	
	for(int j=0; j<i; j++)
		cout << gcd[j] <<" "<< lcm[j] << "\n";
	
	return 0;
}

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

long long a,b;
long long GCD(long long a,long long b)
{
    long long d;
    while(b != 0)
    {
        d = a%b;
        a = b;
        b = d;
    }
    return a;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        long long gcd = GCD(a,b);
        long long p = a/gcd,q = b/gcd;
        long long lcm = p*q*gcd;
        cout<<gcd<<" "<<lcm<<"\n";

    }
    return 0;
}

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

using namespace std;

int gcd(int a,int b);

int main(){
	int a,b,c;
	while(cin >> a >> b){
		c = gcd(a,b);
		printf("%d %d\n",c,a/c*b);
	}


	return 0;
}

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

C++: #include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const int MAX = 510000;

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}


// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
/*
int main() {
    // 前処理
    COMinit();

    // 計算例
    cout << COM(100000, 50000) << endl;
}*/

//printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main(){
    ll N,M;
    while(cin >> N >> M){
        ll n= gcd(N,M);
        cout << n << " " << N / n * M << endl;
    }
}

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

int main(){
int a;
int b;
int c;
int d;
int e;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a%b;
a=b;
b=c;
if(b=0){break;}
}
cout << a <<" ";
cout << (d*e)/a <<endl;}}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n] = {};
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c] = {};
		int s[c] = {};
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		cout << z << " " << y << endl;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

C++: #include <iostream>
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 <iostream>
#include <vector>
#include <algorithm>


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	long tmp(a);
	tmp*=b;
	tmp/=y;
	return tmp;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

C++: #include <iostream>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		u_int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; i++){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << minimul << std::endl;

	}

	return 0;
}

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

int GCD(int a,int b);
int LCM(int a,int b);

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

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a / GCD(a, b)) * b);/*(a*GCD(a,b)*b);*/
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/