Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[50] = {};
	int b[50] = {};
	int g[50] = {};
	int l[50] = {};
	int i = 0;
	while (cin >> a[i] >> b[i]) {
		i++;
	}
	for (int j = 0; j < i; j++) {
		int n, m,aa,bb;
		aa = a[j];
		bb = b[j];
		while (a[j] != b[j]) {

			m = max(a[j], b[j]);
			n =	max(a[j], b[j])  % min(a[j], b[j]);
			a[j] = m;
			b[j] = n;
			
		}
		g[j] = a[j];
		if (g[j] != 0) {
			aa = aa / g[j];
			bb = bb / g[j];
		}
		l[j] = aa * bb * g[j];
		
	}
	for (int k = 0; k < i; k++) {
		cout << g[k] << l[k] << endl;
	}
	return 0;
}

C++: /*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005&lang=jp*/

#include <iostream>

using namespace std;

int gcd(int x,int y){
    if(x<y){
        swap(x,y);
    }
    if(y==0){
        return x;
    }else {
        return gcd(y, x % y);
    }
}

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

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;
}