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<set>
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define RG register int
#define rep(i,a,b)	for(RG i=a;i<=b;++i)
#define per(i,a,b)	for(RG i=a;i>=b;--i)
#define ll long long
#define inf (1<<29)
using namespace std;

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

int main()
{
	ll n,m,g;
	while(~scanf("%lld%lld",&n,&m))
	{
		g=gcd(n,m);
		printf("%lld %lld\n",g,n/g*m);
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>

//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************

int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

//*********************************************************
// 最小公倍数（Least Common Multiple）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

int main(){

	int x,y;
	
	while(std::cin>>x>>y){
		
		std::cout << gcd(x,y) << ' ' << lcm(x,y) << std::endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        scanf("%d %d",&n,&m);
        t=d(n,m);
        printf("%d %d",t,n/t*m);
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

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

int main(){
	ll a,b;
	for(;cin>>a>>b;){
		cout<<gcd(a,b)<<" "<<a*b/gcd(a,b)<<endl;
	}
	return 0;
}

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

int gcd(unsigned long num1,unsigned long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(unsigned long n1, unsigned long n2) {
	return n1 * n2 / gcd(n1, n2);
}

int main() {
	unsigned long a, b;
	while (~scanf_s("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),lcm(a,b));
	}
}

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

int GCD(int a, int b)
{
    int asw;
    int tmp;
    if (a > b) {
        asw = b;
        while (b >= asw) {
            if (!(b % asw) && !(a % asw))
                tmp = asw;
            asw--;
        }
    } else {
        asw = a;
        while (a >= asw) {
            if (!(b % asw) && !(a % asw))
                tmp = asw;
            asw--;
        }
    }
    return tmp;
}

int LCM(int a, int b)
{
    int asw;
    if (a < b) {
        asw = b;
        while (asw % a)
            asw += b;
    } else {
        asw = a;
        while (asw % b)
            asw += a;
    }
    return asw;
}

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

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define int long long

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

unsigned main(){
    int A,B;
	while(cin>>A>>B){
		printf("%d %d\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

C++: #include <stdio.h>
long gcd_euclid(long m, long n) {
long temp;
while (n) {
temp = m % n;
m = n;
n = temp;
}
return m;
}
int main(){
long a, b;
long temp;
long gcd, lcm;
while(scanf("%ld %ld", &a, &b) != EOF){
gcd = gcd_euclid(a, b);
temp = a / gcd;
lcm = temp * b;
printf("%ld %ld\n", gcd, lcm);
}
return 0;
}

C++: #include <iostream>
#include <stdio.h>

int gcd(int c,int d)
{
	if(c<d) std::swap(c,d);
	if(c%d==0) return d;
	else return gcd(d,c%d);
}



int lcm(int c,int d,int f)
{
	return c*d/f;
}

int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		int g=gcd(a,b);
		std::cout<<g<<" "<<lcm(a,b,g)<<std::endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	int  a, b;
	while (cin >> a >> b) {
		cout << __gcd(a, b) << " " << a / __gcd(a, b) * b << endl;

	}

}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b) 
{
    int ma = max(a, b);
    int mi = min(a, b);
    int tmp;
    
    while (mi) {
        tmp = mi;
        mi = ma % mi;
        ma = tmp;
    }
    return ma;
}

int main()
{
    int a, b;
    long lcm_ans;
    long gcd_ans;

    while (cin >> a >> b) {
        gcd_ans = gcd(a, b);
        lcm_ans = a * (b / gcd_ans);
        cout << gcd_ans << ' ' << lcm_ans << endl;
    }

    return 0;
}

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

typedef unsigned int uint;

uint func1(uint a,uint b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

uint func2(const uint a,const uint b){
    uint a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return (a2>=2000000000)?2000000000:a2;
}

int main(){
    uint a,b;
    cin >> a >> b;
    if(a>2000000000 || b>2000000000)return 0;

    cout << func1(a,b) << " " << func2(a,b);

    return 0;
}

C++: # include <iostream>

unsigned long a, b;

unsigned long gcd(unsigned long x, unsigned long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

unsigned long  lcm(unsigned long x, unsigned long y, unsigned long g) {
	return x / g*y;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

C++:  #include <stdio.h>
using namespace std;
long long int n,m,ans,amari,ahokusa;

 int main()
 {
    while(scanf("%lld%lld",&n,&m) != -1)
    {
         ans  = n*m;
         if(n < m)
         {
             ahokusa = n;
             n = m;
             m = ahokusa;
         }
         amari = n % m;
         while(amari != 0)
         {
            n = m;
            m = amari;
            amari = n % m;
         }
         ans = ans / m;
         printf("%lld %lld\n",m,ans);
    }

     return 0;

 }

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	
	while (cin>>a>>b)
	{
		a1 = a;
		b1 = b;
		if (a==b)
		{
			g = a;
			break;
		}
		if (a == 0 || b == 0)
		{
			break;
		}
		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a < b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1 / g)*b1;
		cout << g << " " << l << endl;
		
		a1 = a; b1 = b;
	}
}