Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    if(a == 0 || b == 0)
        return 0;
    if(b > a)
        swap(a, b);
    long long tmp;
    while((tmp = a % b) != 0){
        a = b;
        b = tmp;
    }
    return b;
}

long long lcm(long long a, long long b){ // Å¬ö{
    return a / gcd(a, b) * b;
}

int main()
{
    for(;;){
        long long a, b;
        if(!(cin >> a >> b))
            return 0;
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}

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