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

long long gcd(long long a,long long b){
    if(b>a){long long t=a;a=b;b=t;}
    while(true){
        if(a%b==0){return b;}
        else{a=a%b;}
        if(b%a==0){return a;}
        else{b=b%a;}
        }
}

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

int main ()
{
    long long x,y;
    while(cin>>x>>y){
    cout<<gcd(x,y)<<' '<<lcm(x,y)<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int x,int y);
int lcm(int x,int y);

int main(){
  int a,b;

  cin >> a >> b;

  cout << gcd(a,b) <<" "<<lcm(a,b)<<endl;

  return 0;
}

int gcd(int x,int y){
  int z;
  while(y != 0){
  z = x%y; 
  x = y;
  y = z;
  }
  return x;
}

int lcm(int x,int y){

  return x/gcd(x,y)*y;

}

C++: #include<stdio.h>
int gcd(int x,int y){
    int r,m;
    if(x < y){
        m=x;
        x=y;
        y=m;
    }
    while(y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int main()
{
    unsigned long long int a,b,x,n;
    while(scanf("%lld%lld",&a,&b)!=EOF){
        x=gcd(a,b);
        printf("%lld ",x);
        n=a/x*b;
        printf("%lld\n",n);
    }
    return 0;
}

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

int main(){
  int a,b,ky,kb,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

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

int main(){
	long long a,b,GCD,LCM,x,a2,b2;
	while(cin>>a>>b){
	a2=a;
	b2=b;
	while(a!=b){
		if(a>b){
			x=a-b;
			a=b;
			b=x;
		}
		else if(b>a){
			x=b-a;
			b=a;
			a=x;
		}
	}
	GCD=a;
	LCM=a2*b2/a;

	cout<<GCD<<" "<<LCM<<endl;
	}
	return 0;
}

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

int main() {
	// your code goes here
	int a,b;
	int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2)
		cout << miner << endl;
		cout << a*b/miner << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i <= _##i poi i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi i < _##i poi i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i >= _##i poi i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi i > _##i poi i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

using namespace std;

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

template<class T> T gcd(T a, T b){
    if(b) return gcd(b, a % b) poi
    else return a poi
}

int main(){
    long long a, b poi
    while(cin >> a >> b)
        cout << gcd(a, b) << " " << a * b / gcd(a, b) poipoi poi
    return 0 poi
}

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