Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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<iostream>
using namespace std;
int gcd(int,int);
int main(){
    long long x, y;
    long long st;
    while(cin >> x >> y){
        if(x >= y){
            st = gcd(x, y);
            cout << st << " ";
        }else{
            st = gcd(y, x);
            cout << st << " ";
        }
        cout << x * y / st << endl;
    }
    return 0;
}
int gcd(int a, int b){
    int r;
    while(b > 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

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

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

long lcm(long a, long b) {
  return (a*b) / gcd(a, b);
}

int main() {
  long a, b; 

  while(cin >> a >> b) {

    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}

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

typedef long long ll;

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

ll lcm(ll m, ll n) {
    if(m == 0 || n == 0) return(0);
    return(m * n / gcd(m, n));
}

int main(void) {
    ll a, b;
    
    while(scanf("%lld %lld", &a, &b) != EOF) cout << gcd(a, b) << " " << lcm(a, b) << endl;
    
    return(0);
}

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

int euclide(int m, int n)
{
  int tmp;
  if(n == 0)
    return m;
  tmp = n;
  n = m % n;
  m = tmp;
  euclide(m, n);
}

int main()
{
  int a, b;
  while(cin >> a >> b){
    if(a < b){
      int tmp = a;
      a = b;
      b = tmp;
    }
    int gcd = euclide(a, b);
    cout << gcd << ' ' << a * (b / gcd) << endl;
  }
}

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

int main(){
  int a,b;

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

C++: #include<stdio.h>


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

	//無限ループ
	for (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 int kouyakusuu = 0;
	unsigned long long int koubaisuu = 0;
	//入力
	int a = 0,b = 0;

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

	return 0;
}

C++: #define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    return 0;
}

C++: #include<stdio.h>
int main()
{
    
    long long res,x,y,m,n;
    while(scanf("%lld %lld",&m,&n)!=EOF)
    {
        res=m%n;
y=n;
        while(res)
        {x=y;

            y=res;
           res=x%y;
        }

printf("%lld%lld\n",y,m*n/y);


    }
    return 0;
}

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

int GCD(int a,int b){
	int temp;
	while(b!=0){
		temp=b;
		b=a%b;
		a=temp;
	}
	return a;
}

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

int main() {
	int a,b,gcd,lcm;
	while(cin>>a>>b){
		if(b>a) swap(a,b);
		gcd=GCD(a,b);
		lcm=LCM(a,b,gcd);
		cout<<gcd<<" "<<lcm<<endl;
	}
	return 0;
}

C++: #pragma GCC optimize(2)
#define LOCAL0
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define xx first 
#define yy second
#define INF 0x3f3f3f3f
void read(int &p)
{
    p=0;int flag=1;char c=getchar();
    while(!isdigit(c)) {if(c=='-') flag=-1;c=getchar();}
    while(isdigit(c)) {p=p*10+c-'0';c=getchar();}p*=flag;
}
ll x,y;

ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return max(a,b)/gcd(a,b)*min(a,b);
}

int main()
{
    #ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    while(cin>>x>>y) printf("%lld %lld\n",gcd(x,y),lcm(x,y));
    return 0;
}

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (1) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

using namespace std;

int gcd(int,int);

int main()
{
	int a,b,GCD,LCM;

	while(scanf("%d %d",&a,&b) != EOF)
	{
		GCD = gcd(a,b);

		LCM = (a*b) / GCD;

		printf("%d %d\n",GCD,LCM);
	}

	return 0;
}

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

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(i>50){
cin>>a>>b;
x=a;y=b;
while(1){

  if(x<y){y-x;}
  else if(x>y){x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
if(a==0 || b==0){cout<<0<<" "<<0<<endl;}
else{cout<<g<<" "<<L<<endl;}
  ++i;
}
  return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(void){
    long long  a,b,c,A,B;
    while(cin >> a >> b){
        A=a;
        B=b;
        while(b!=0){
            c=a%b;
            a=b;
            b=c;
        }
    cout<<a<<' '<<A/a*B<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

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

unsigned long calc_gcd(unsigned long a, unsigned long b) {

  while(b != 0) {
    unsigned long c = b;
    b = a % b;
    a = c;
  }
  return a;
}

int main() {
  unsigned long a,b;

  while(scanf("%ld %ld", &a, &b) != EOF) {
    unsigned long gcd = calc_gcd(a, b);
    std::cout << gcd << " " << a*b/gcd << std::endl; 
  }
}