Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

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

int max(int a, int b){
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    while(cin >> a >> b){
        cout << max(a, b) << " " << min(a, b) << endl;
    } 
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEFINE
#include "../../DEBUG.hpp"
#endif

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  while (cin >> a >> b) {
    long long gg = __gcd(a, b);
    long long l = (a * b) / gg;
    cout << gg << " " << l << '\n';
  }
  return 0;
}

C++: #include <iostream>

inline u_long lcm(u_long a, u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}