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<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}
int lcm(int c,int d){
  int e=gcd(c,d);
  return c/e*d;
}


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

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>


using namespace std;

int main() {

    long ain,bin;
    long c,d,e,gcm,lcd;
    
    cin >> ain >> bin;
    if (ain < bin) {
        c = ain;
        ain = bin;
        bin = c;
        c=0;
    }

    c=ain;
    d=bin;

    for(;;) {
        if(d==0) {
            gcm = c;
            lcd = ain * bin / gcm;
            break;
        }
        e = c % d;
        c = d;
        d = e;
    }

    cout << gcm << " " << lcd << endl;


    return 0;
}

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

long gcd(long a, long b){
    if(a < b){
        swap(a, b);
    }else{
        while(b > 0){
            long r = a % b;
            a = b;
            b = r;
        }
    }
    return a;
}

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

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

C++: #include <iostream>

using namespace std;

using ll = long long;

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

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

C++: #include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y){

    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y,x%y);

}

int main(){

    cin.sync_with_stdio(false);

    long long x,y;

    while(cin >> x >> y){

        long long m = gcd(x,y);

        cout << m << " " << x/m * y << endl;

    }

    return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

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

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

using namespace std;

typedef long long ll;

ll a, b;

ll gcd(ll a, ll b)
{
	if(!b)
		return a;
	if(a < b)
		return gcd(b, a);
	if(!(a&1) and !(b&1))
		return gcd(a>>1, b>>1)<<1;
	else if(!(a&1))
		return gcd(a>>1, b);
	else if(!(b&1))
		return gcd(a, b>>1);
	else
		return gcd(b, a-b);
}

ll lcm(ll g)
{
	return a*b/g;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	while(true)
	{
		if(scanf("%lld", &a) == EOF || scanf("%lld", &b) == EOF)
			return 0;
		ll g = gcd(a, b);
		printf("%lld %lld\n", g, lcm(g));
	}
}

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