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 <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ll long long
#define V 1000000
static const double PI=6*asin(0.5);

/*
bool operator < (ll a,ll b){
	return a>b;
}
*/

bool prime[V];
vector<ll> pri;
priority_queue<ll,vector<ll>,greater<ll> > a_pri;
priority_queue<ll,vector<ll>,greater<ll> > b_pri;
map<ll,ll> amap;
map<ll,ll> bmap;

void divisor(int n,priority_queue<ll,vector<ll>,greater<ll> > qu){
	for(int i = 2; i*i<=n;i++){
		if(n%i==0){
			qu.push(i);
			cout<<"i = "<<i<<endl;
			if(i!=n/i&&i!=n){
				qu.push(n/i);
				cout<<"n/i = "<<n/i<<endl;
			}
		}
	}
	cout<<endl;
}

map<ll,ll> prime_factor(int n){
	map <ll,ll> res;
	for(int i=2;i*i<=n;i++){
		while(n%i==0){
			++res[i];
			//cout<<"res = "<<res[i]<<" "<<i<<endl;
			n/=i;
		}
	}
	//cout<<"n = "<<n<<endl;
	if(n!=1) res[n]=1;
	//cout<<"map[2] = "<<res[2]<<endl;
	return res;
}

void prime_is(){
	prime[1] = true;
	//cout<<"hoge";
	for(int i=1;i*i<V;i++){
		if(!prime[i]){
			pri.push_back(i);
			for(int j=i*i;j<V;j+=i){
				prime[j] = true;
			}
		}
	}
}

int main(){
	ll a,b;
	ll gcd=1,lcm=1;
	
	//rep(i,V) prime[i] = false;
	//prime_is();
	while(cin>>a>>b){
		ll a_tmp=a, b_tmp=b;
		
		//a_pri.clear(); b_pri.clear();
		
		/*
		cout<<a_tmp<<" ";
		rep(i,10){
			cout<<pri[i]<<" ";
		}
		cout<<endl;
		*/
		//cout<<a<<" "<<b<<endl;
		/*
		rep(i,V){
			if(a_tmp==1){
				//cout<<"break\n";
				break;
			}
			while(a_tmp%pri[i]==0){
				a_pri.push(pri[i]);
				a_tmp/=pri[i];
			}
			//cout<<a_tmp<<endl;
		}
		rep(i,V){
			if(b_tmp==1){
				//cout<<"break";
				break;
			}
			while(b_tmp%pri[i]==0){
				b_pri.push(pri[i]);
				b_tmp/=pri[i];
			}
			//cout<<"b_tmp = "<<b_tmp<<endl;
			//cout<<"t = "<<t<<endl;
			
		}
		*/
		//divisor(a,a_pri);
		//divisor(b,b_pri);
		
		amap = prime_factor(a);
		bmap = prime_factor(b);
		
		rep(i,a){
			rep(j,amap[i]){
				a_pri.push(i);
				//cout<<"i = "<<i<<endl;
			}
		}
		rep(i,b){
			rep(j,bmap[i]){
				b_pri.push(i);
			}
		}
		
		//cout<<"hoge\n";
		gcd = lcm = 1;
		rep(i,V){
			if(a_pri.empty()||b_pri.empty()) break;
			//cout<<a_pri.front()<< " "<<b_pri.front()<<endl;
			if(a_pri.top()>b_pri.top()){
				//cout<<"a\n";
				lcm*=b_pri.top();
				b_pri.pop();
			}
			else if(a_pri.top()==b_pri.top()){
				//cout<<"=\n";
				gcd*=a_pri.top();
				lcm*=a_pri.top();
				a_pri.pop();
				b_pri.pop();
			}
			else{
				//cout<<"b\n";
				lcm*=a_pri.top();
				a_pri.pop();
			}
		}
		while(!a_pri.empty()){
			lcm*=a_pri.top();
			a_pri.pop();
		}
		while(!b_pri.empty()){
			lcm*=b_pri.top();
			b_pri.pop();
		}
		cout<<gcd<<" "<<lcm<<endl;
		
	}
	
	return 0;
}

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

int gcd(int m, int n) {
	if (n == 0)return m;
	while (m%n != 0) {
		m = m%n;
		swap(m, n);
	}
	return n;
}

int main() {
	int a, b; vector<int> GCDS; vector<int> LCMS;
	while (cin >> a >> b) {
		GCDS.push_back(gcd(a, b));
		LCMS.push_back(a*b / gcd(a, b));
	}
	for (int i = 0; i < GCDS.size(); i++) {
		cout << GCDS[i] << ' ' << LCMS[i] << endl;
	}
}

C++: #include <iostream>
#include <boost/math/common_factor.hpp>
#include <boost/bind.hpp>
using namespace std;
using namespace boost;
using namespace math;

int main(){
  int a, b;

  while(cin >> a >> b){
    
    cout << gcd(a, b) <<  ' ';
    cout << lcm(a, b) << endl;
    
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}
int lcm(long long a, long long b,long long gcmed) {
	return (a*b / gcmed);
}
int main(){
	long long a,b;
	while (cin >> a >> b) {
		long long c = gcd(a, b);
		printf("%lld %lld\n", c, lcm(a, b, c));
	}
}

C++: #include <stdio.h>

int euclid(int a, int b);

int main(void)
{
	int a, b;
	int koyaku, kobai;
	
	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			koyaku = euclid(a, b);
		}
		else {
			koyaku = euclid(b, a);
		}
		
		kobai = a * b / koyaku;
		
		printf("%d %d\n", koyaku, kobai);
	}
	
	return (0);
	
}

int euclid(int a, int b)
{
	int c;
	c = a % b;
	
	if (c == 0){
		return (b);
	}
	
	return (euclid(b, c));
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}

		gcd = x;
		lcm = a * b / gcd;	
	
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <cstdio>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int a,b;
while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a*b/g(a,b));
}

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

int max(int a, int b){
    int c;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    cin >> a >> b ;
    
    cout << max(a, b) << min(a, b) << endl;
    
    return 0;
}

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

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

int main(){
  int a,b;
  while(cin >> a >> b){
    int g = gcd(a,b);
    //lcm == a*b/gcd(a,b)で求まる
    //cout << g << " " << a*b/g << endl;  <-オーバーフローする
    cout << g << " " << a/g*b << endl; // <-オーバーフローしない
  }
}

C++: #include <iostream>

//calc G.C.D(m >= n)
int calcGcd(int m, int n);
//calc L.C.M
inline int calcLcm(int m, int n, int gcd);

int main(){
	int a, b;
	
	while(std::cin >> a >> b){
		int gcd, lcm;
		
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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

int gcd(int a, int b)
{
     return(b ? gcd(b, a % b):a);
}

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

C++: #include <iostream>
using namespace std;
int main() {
    int a, b;
    while (cin >> a >> b) {
        long long ta = a, tb = b, tmp;
        while (ta != 0) {
            tmp = ta;
            ta = tb % ta;
            tb = tmp;
        }
        cout << tb << " " << a / tb * b << endl;
    }
    return 0;
}

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

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

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