Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include<stdio.h>


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

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

	return kouyakusuu_ans;
}



//公倍数の関数
/**/ long long int koubaisuu_f(/**/ long long int a,/**/ long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	/**/ 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)
{
	//公倍数と公約数
	/**/ long long int kouyakusuu = 0;
	/**/ long long int koubaisuu = 0;
	//入力
	/**/ long long int a = 0,b = 0;

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

	return 0;
}

C++: #include<stdio.h>


int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;

		while(i==j){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}

		y=x*y/i;
		x=i;


		printf("%lld %lld\n",x,y);
	}

	return 0;
}

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

int main(void){
    long long int a,b,tmp;
    while (cin>>a>>b) {
        long long int A=a;
        long long int B=b;
        if (b>a) {
            tmp=b;
            b=a;
            a=tmp;
        }
        while (a%b!=0) {
            tmp=b;
            b=a%b;
            a=tmp;
        }
        cout<<b<<" "<<(A*B/b)<<endl;
    }
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
	return 0;
	}}

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

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

void main(){
	long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g);
	}
}

C++: #include <iostream>

using namespace std;

int gcd(int x, int y)
{
	for(;x;)
	{
		int r = y % x;
		y = x;
		x = r;
	}
	return y;
}

int main()
{
	while(!cin.eof())
	{
		int a, b;
		cin>>a>>b;

		int g = gcd(a, b);
		cout << g << " " << a / g * b << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
#define int long long
	int a, b, r, x, temp;
	cin >> a >> b;
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
long long gcd(long long x,long long y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        long long d=gcd(a,b);
        a/=d;
        b/=d;
        long long l=a*b*d;
        cout<<d<<" "<<l<<endl;
    }
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

inline int get_LCM(const u_int a, const u_int b, const u_int GCD)
{
    return a * (b / GCD);
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << get_LCM(a, b, GCD) << std::endl;
    }    

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, int>;

int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

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;

int GetGCD(int m, int n){
	if(n == 0){
		return m;
	}

	return GetGCD(n, m%n);
}

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

int main(){
	int a, b;
	int g, l;

	while(cin >> a >> b){

		if(a > b){
			g = GetGCD(a, b);
		}else{
			g = GetGCD(b, a);
		}

		l = GetLCM(a, b, g);
		cout << g << ' ' << l << 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() {
	long long a, b, c,d,e,A,B,C;
	c = 9;
	d = 9;
	e = 9;
	C = 9;
	while (cin >> a >> b) {
		if (a < b) { swap(a, b); }
		A=gcd(a, b);
		C = a*b / A;
		cout << A << ' ' << C << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	long i,g,j,ti,tj;
while(cin>>i>>j)
{
	g=-1;ti=i;tj=j;
	while(g==-1)
	{
	if(i<j){j=j-i;}
else if(i>j){i=i-j;}
else if(i=j){g=i;}
else if (i==0){g=j;}
else if(j=0){g=i;}
	}
cout<<g<<" ";
cout<<ti/g*tj<<endl;
}


return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{int a, b, c = 0;while (cin >> a, cin >> b){for (int i = 1; i <= a, i <= b; i++){if (a % i == 0 && b % i == 0){c = i;}}cout << c << " " << a*b / c << endl;}return 0;}

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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		long numerator=min(a,b);
		long denominator=max(a,b);
		long remainder = a % b;
		while(remainder !=0)
		{
			 numerator   = denominator;
			denominator = remainder;
			remainder   = numerator % denominator;
		}
		long gcd = denominator;
		long long lcm = a * (b / gcd);
		cout<<gcd<<" "<<lcm<<endl;
	
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

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

C++: #include <iostream>
using namespace std;
int Gcd(int a,int b){
    int r=-1;
    int temp;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

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


    while(cin>>a>>b){
        gcd = Gcd(a,b);
        a=a/gcd;
        b=b/gcd;

        printf("%d %d\n",gcd,gcd*a*b);
    }

    return 0;
}

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

using namespace std;

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

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

int main(){
    int a, b, g, l;

    while (cin >> a >> b) {
        g = a > b ? gcd(a, b) : gcd(b, a);
        l = a > b ? lcm(a,b,g) : lcm(b,a,g);

        cout << g << " " << l << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{int a, b, c = 0;while (cin >> a, cin >> b){for (int i = 1; i <= a, i <= b; i++){if (a % i == 0 && b % i == 0){c = i;}}cout << c << " " << a*b / c << endl;}return 0;}