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() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

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

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

C++: //
//  main.cpp
//  b
//
//  Created by h3037178 on 2017/07/31.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
    long long a,b,s,d;
    while(cin>>a>>b){
        for(int o=2000000;o>0;o--){
            if(a>=20000000||b>=20000000){
                break;
            }
            if(a%o==0&&b%o==0){
                s=o;
                 d=a*b/s;
                cout<<s<<" "<<d<<endl;
                break;
            }
        }
    }
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __gcd(n, m)*m);
    }
    return 0;
}

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

using namespace std;

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

	}

}

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

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


long long	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,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 == 0 || b == 0)
		{
			break;
		}
		
		else if (a1 == b1)
		{
			g = a1;
			
		}
		else
		{
			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;
	}
}