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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		long numerator=min(a,b);
		long denominator=max(a,b);
		long remainder = a % b;
		while(remainder !=0)
		{
			 numerator   = denominator;
			denominator = remainder;
			remainder   = numerator % denominator;
		}
		long gcd = denominator;
		long long lcm = a * (b / gcd);
		cout<<gcd<<" "<<lcm<<endl;
		/*
		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+=max(a,b))
		{
			if(i%a ==0)
				if(i%b==0)
				{
					cout<<i<<endl;
					break;
				}
		}*/
	}
}

C++: # include <iostream>

unsigned long long a, b;

unsigned long long gcd(unsigned long long x, unsigned long long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

unsigned long long lcm(unsigned long long x, unsigned long long y, unsigned long long g) {
	return x / g*y;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
long long int a, b;
long long int gcd()
{
	long long int min = a,other=b;
	if (b < a){
		min = b; other = a;
	}
	long long int i;
	for (i = 1; i <= sqrt(long double(min)); i++)
	{
		if (min%i == 0)
		{
			if (other % (min / i) == 0)
				return min / i;
		
		}
	}
	for (i = sqrt(long double(min)); i >= 1; i--)
	{
		if (min%i == 0)
		{
			if (other %  i == 0)
				return i;
	     }
		
	}
}
int main()
{
	while (scanf("%lld %lld",&a,&b)==2)
	{
		long long int g = gcd();
		printf("%lld ", g);
		printf("%lld\n", (a / g)*(b / g)*g);
	}
}

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

int main(){
  int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
   unsigned long int LCM = a;
   tmp = b;
    if( b > a )std::swap( a , b );
    while(a % b != 0){
      GCD = a % b;
      a = b;
      b = GCD;
    }
    LCM = ( LCM / GCD ) * tmp;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T>
map<T, ll> get_zaatu(vector<T> vals) {
  sort(all(vals));
  vals.erase(unique(all(vals)), vals.end());
  map<T, ll> res;
  rep(i, vals.size()) res[vals[i]] = i;
  return res;
}
template<typename T>
void zaatu(vector<T>& vals) {
  map<T, ll> z = get_zaatu(vals);
  each(x, vals) x = z[x];
}
// template<typename T1, T2>
// void zaatu(vector<T1>& vals, const function<T2(T1)>& f) {
//   vector<T&> v;
//   each(x, vals) v.pb(f(x));
//   zaatu(v);
// }


int main() {
  ll a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << endl;
  }
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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

C++: 
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
	long long ta=a,tb=b;
	long long s=0,m=0;
	if(a<b)swap(a,b);
	
	while(true){
		long long  tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

C++: #include <iostream>

int main()
{
    int a, b;
    while (std::cin >> a >> b) {
        if (b > a) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int m = a;
        int n = b;

        while (n != 0) {
            int tmp = n;
            n = m % n;
            m = tmp;
        }
        std::cout << m << " "<< (a * b / m) << std::endl;
    }

    return 0;
}

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

int gcd(int x,int y){
    int a,b;
    a=x;
    b=y;
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
    int x,y;
    while(cin>>x>>y){
        int c=gcd(x,y);
        int lcm=(x*y)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,gcd=0,lcm=0,min=0,count=0;
    while(cin>>a>>b){
        count++;
        if(count>50)break;
    if(b>a)min=a;
    else min=b;
    
    for(long int k=min;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    
   gcd=a*b/lcm;
    
    cout<<lcm<<" "<<gcd<<endl;
    
}
}

C++: #include <iostream>
#include <algorithm>
#define MAX_N 1001
using namespace std;
typedef long long ll;
//lcs
int n,m;
string s,t;
int dp[MAX_N+1][MAX_N+1];
void solve(){
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++){
      if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
      else dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
    }
  cout<<dp[n][m]<<endl;
}
//lcm
ll lcm(int gcdv,int a,int b){
  return (ll)a*b/gcdv;
}
//greatest common divisor
int main() {
  int a,b;
  while(cin>>a>>b){
    int r=__gcd(a,b);
    cout<<r<<' '<<lcm(r,a,b)<<endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<cmath>

long long gcd(long long a, long long b)
{
    return b?gcd(b,a%b):a;
}
long long m,n;
int main()
{
    while(~scanf("%lld%lld",&m,&n))
    {
        long long temp = gcd(m,n);
        printf("%lld %lld\n",temp,m/temp*n);
    }
    return 0;
}

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

int main() {
	int x;
	int y;
	int g;
	while (scanf("%d %d", &x, &y)!=EOF) {
		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;
}