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 <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <vector>
using namespace std;

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

int getLcm(int a, int b) {
  bool end = false;
  int multi = 1;
  while (!end) {
    if (a * multi % b == 0) {
      break;
    }
    multi++;
  }
  return a * multi;
}

int main(int argc, char const *argv[]) {
  int ans_gcd, ans_lcm, a, b, tmp;
  while (!(cin >> a >> b).eof()) {
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    ans_gcd = getGcd(a, b);
    ans_lcm = getLcm(a, b);
    std::cout << ans_gcd << " " << ans_lcm << '\n';
  }
  return 0;
}

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

int main() {
	int a = 0;
	int b = 0;
	int max = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
		}
		else {
			max = a;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max; c++) {
			while (a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;

			}
		}
		cout << d << '\n';
		d = a_bk * b_bk / d;
		cout << d << "\n";

	}
	return 0;
}

C++: #include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <algorithm>

using namespace std;

long long int a,b,gcd,lcm;

int main()
{
	while(scanf("%lld %lld", &a, &b) != EOF)
	{
	if (a==b)
	{
		gcd=a;
		lcm=b;
	}
	else
	gcd=__gcd(a,b);
	lcm=a/gcd*b;
    printf("%lld %lld\n",gcd,lcm);
	}
	return 0;
}

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

int gcd(int a, int b) {
  if (a <= 0) return b;
  return gcd(b%a, 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;
  }
  return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0;
   while(cin >> a >> b){
      if(a<b){
         tmp=a;
         a=b;
         b=tmp;
      }
      while(1){
         if(a%b==0){
            m=b;
            break;
         }
         else{
            a=a-b;
            tmp=a;
            a=b;
            b=tmp;
         }
      }
      s=a*b/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include<utility>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
using namespace std;

template<class T>inline string toString(T x){
        ostringstream sout; sout<<x; return sout.str();
}
const ll MOD=1e9+7;
const int inf=(ll)1e9;
const double PI=acos(-1.0);

inline ll LCM(ll a,ll b){
	int g=__gcd(a,b);
	return g?(a/g*b):0;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout<<fixed;
	ll n,m;
	while(cin>>n>>m){
		ll ans1=__gcd(n,m);
		ll ans2=LCM(n,m);
		cout<<ans1<<" "<<ans2<<endl;
	}
	return 0;
}

C++: #include <iostream>

inline int calcGcd(int x,int y){
	while(x % y != 0){
		int num = x % y;
		x = y;
		y = num;
	}
	return y;
}

inline int calcLcm(int x,int y){
	return x / calcGcd(x,y) * y;
}

int main(){
	int a,b;
	while(std::cin >> a >> b)
		std::cout<< calcGcd(a,b)<<" "<<calcLcm(a,b)<<std::endl;
}

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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		for(long i=min(a,b);i>0;i--)
		{
			if(a%i ==0)
				if(b%i==0)
				{
					cout<<i<<" ";
					break;
				}
		}
		for(long i=max(a,b);i<=2000000000;i++)
		{
			if(i%a ==0)
				if(i%b==0)
				{
					cout<<i<<endl;
					break;
				}
		}
	}
}

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

using namespace std;

int GCD(int a, int b) {
	if (b == 0) {
		return a;
	}
	return GCD(b, a%b);
}
int LCM(int a, int b) {
	return a / GCD(a, b)*b;
}

int main() {
	for (int a, b; cin >> a >> b;) {
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b) {
  if(a == 0) return b;
  return gcd(b%a, 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;
  }
  return 0;
}

C++: #pragma warning(disable:4996)
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef int LL;

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

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

int main() {
	LL a, b;
	while (~scanf("%Id%Id", &a, &b)) {
		printf("%Id %Id\n", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1/gcd*a2;
        }
        cout << gcd << " " << lcm << endl;
    }
}

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

void solve(int a,int b){
	int c=29999,numa=0,numb=0;
	numa=a;
	numb=b;
	if(a<b) swap(a,b);
	while(c!=0){
		c=a%b;
		a=b;
		b=c;
	}
	cout<<a<<" "<<numb/a*numa<<endl;
}

int main(){
	int a,b;
	while(cin>>a>>b){
		solve(a,b);
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <limits>
using namespace std;

int main() {
	long long x;
	long long y;
	long long g;
	while (scanf("%I64d %I64d", &x, &y)) {
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

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

using namespace std;

//????°???¬?????°
unsigned int comp_GCD(unsigned int a, unsigned int b){
	while(1){
		unsigned int r;
		r = a % b;
		a = b;
		b = r;
		if(b == 0){
			return a;
		}
	}
	return 0;
}

//?????????
int main() {
	unsigned int a, b;
	vector<unsigned int> result_gcd;
	vector<unsigned int> result_lcm;
	while(cin >> a >> b){
		unsigned int gcd = comp_GCD(a, b);
		result_gcd.push_back(gcd);
		result_lcm.push_back(a * (b / gcd));
	}
	for(unsigned int i = 0; i < result_gcd.size(); i++){
		cout << result_gcd[i] << " " << result_lcm[i] << endl;
	}
	return 0;
}