Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/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
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define ll long long
using namespace std;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll int n, m;
  while(cin >> n >> m) {
    ll int gcd = __gcd(n, m);
    ll int lcm = n * m / gcd;
    cout << gcd << ' ' << lcm << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(scanf("%d %d",&a,&b)!=EOF){
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}
}

C++: #include<iostream>
using namespace std;
long long int a,b;
int gcd(int a,int b)
{
	if(b==0) return a;
	return gcd(b,a%b);
}

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

C++: #include <stdio.h>


int main(void)
{
	unsigned int		 a,b,ax,bx, min, max, test_min[200], test_max[200];
	int			i,j=0;
	
	while(scanf("%d %d",&a, &b) != EOF){
		ax = a;
		bx = b;
		while(1){
			if(a > b){
				b = b+bx;
			}
			else if(b > a){
				a = a+ax;
			}
			else{
				break;
			}	
		}
		min = a;
		max = (ax*bx)/min;
		
		test_min[j] =min;
		test_max[j]=max;
		j++;
	}
	for(i=0;i<=j; i++){
		printf("%d %d\r\n", test_max[i], test_min[i]);
	}
	return 0;
}

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