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