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>
#include <cstdio>
using namespace std;

int gcd(int a, int b) {
	if(b > a){
		int j = a;
		a = b;
		b = j;
	}
	int r;
	while((r = a % b) != 0)
		{ a = b; b = r; }
	return b;
}

int main(void){
    int a, b;
    while(cin >> a >> b) {
      int lcm = a / gcd(a,b) * b;
      cout << gcd(a,b) << " " << lcm << 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;
	}
	getchar();
	getchar();
	return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b;
    while (cin >>a >>b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

int gcd(int a,int b){
    int n;
    if (a>b){
        n=b;
        b=a;
        a=n;
    }
    n = a;
    while(b%a!=0){
        n=b%a;
        b=a;
        a=n;
    }
    return n;
}

int lcm(int a,int b){
    int n = a/gcd(a,b)*b;
    return n;
}

C++: #include<iostream>
using namespace std;
int main(){
    long int a,b;
    while(cin>>a>>b){
        if(b>a)swap(a,b);
        int lcm=a*b;
        while(a%b){
            int c=a%b;
            a=b;
            b=c;
        }
        cout<<b<<" "<<lcm/b<<endl;
    }
}

C++: #include<stdio.h>


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

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

	return kouyakusuu_ans;
}



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

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

	return 0;
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl;
}

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

C++: #include <bits/stdc++.h>
#define INT(name) int name; scanf("%d",&name);
#define VINT(name,n) vector<int> name(n); for(int i = 0;i < n;i++) scanf("%d",&name[i]);

using namespace std;

int gcd_(int a,int b){
	if(a == b)	return a;
	int temp = a - b;
	if(temp < b)	swap(temp,b);
	return gcd_(temp,b);
}

int main(int argc, char const *argv[]){
	int a,b,gcd,lcm;
	while(cin >> a >> b){
		if(a < b)	swap(a,b);
		gcd = gcd_(a,b);
		lcm = a / gcd * b;
		printf("%d %d\n",gcd,lcm);
	}
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

int main()
{
ll a,b;
while(~scanf("%lld %lld",&a,&b)){
printf("%lld %lld",gcd(a,b),(a*b)/gcd(a,b));
}
}

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

int main(void)
{
	long long  l1, l2, tmp1, tmp2, tmp;
	while (cin >> l1 >> l2) {
		tmp1 = max(l1, l2);
		tmp2 = min(l1, l2);
		while (tmp1 && tmp2) {
			tmp = tmp1 % tmp2;
			tmp1 = tmp2;
			tmp2 = tmp;
		}
		tmp2 = l1 * l2 / tmp1;

		cout << tmp1 << " " << tmp2 << endl;
	}

	return 0;
}

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

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

int main(){
    long long a,b,ans =0;

    while(cin>>a>>b){
    ans =0;
   
    ans=gcd(a,b);
    cout<<ans<<" "<<a*b/ans<<endl;
}
}

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

int main(){
	long long int a,b,x,y,z;
	
	while(cin >> a >> b,a,b){
		x=max(a,b);
		y=min(a,b);
		while(1){
			if(y==0) break;
			z=x%y;
			x=y;
			y=z;
		}
		
		cout << x << ' ' << a*b/x << endl;
	}
	
	return 0;
}

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

int main(){
  int a, b;
  int ca, cb, tmp;
  int gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb==0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a*b/gcd;

    printf("%d %d\n", gcd, lcm);
  }

  return 0;
}

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

int main() {
	unsigned int a, b;
	while (cin >> a >> b) {
		unsigned int gcd = a, lcm;
		while (a%gcd != 0 || b%gcd != 0) gcd--;
		lcm = (a / gcd)*(b / gcd)*gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,x,y,r;
	while(1){
		cin>>a>>b;
		if(cin.eof())	break;
		x=a;	y=b;
		while(1){
			if(b>a)	swap(a,b);
			r=a%b;
			if(r==0)	break;
			a=b;
			b=r;
		}
		cout<<b<<" "<<(long long)x*y/b<<endl;
	}
	return 0;
}

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

using namespace std;

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

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

int main(){
	long long int M, N;
	while (cin>>M>>N){
		cout << gcd(M, N) << " " << lcm(M, N) << "\n";
	}
	return 0;
}

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

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

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