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<cstdio>
using namespace std;

int main(){
    int a,b,a1,b1,r;
    int tmp=0;
    int i=0;
    
    while(cin>>a>>b){
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }
        
        a1=a;
        b1=b;
        r=a1%b1;
        while(r!=0){
            a1=b1;
            b1=r;
            r=a1%b1;
            
        }
        printf("%d %ld\n",b1,(long)a*b/b1);
    }
    
    
    return 0;
    
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  long long a,b,mi,ma;
  while(cin>>a>>b){
    ma=max(a,b);
    mi=min(a,b);
    while(1){
      if(ma%mi==0){
	cout<<mi<<" "<<a*b/mi<<endl;
	break;
      }
      swap(ma,mi);
      mi=mi%ma;
    }
  }
}

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

int main(void){
    long long a,b,x,r,aa,bb;
    
while(cin >> a >> b){
    
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    aa = a;
    bb = b;
    
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    cout << a << " " << aa*bb/a << endl;
}

    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d;
	int i,j,k;
	while(cin>>a>>b){
		c=a;
		d=b;
		while(d!=0){
			c%=d;
			swap(c,d);
		}
		a/=c;
		b/=c;
		d=a*b*c;
		cout<<c<<" "<<d<<endl;
	}
	return 0;
}

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

int main(){
	int a, b, c;
	long long int d, e;
	while (cin >> a >> b){
		c = a;
		d = a;
		e = b;
		while (a != b){
			if (a > b){
				c = a - b;
				a = b;
				b = c;
			}
			else {
				c = b - a;
				a = b;
				b = c;
			}
		}
		cout << c << " " << d*e/c << '\n';
	}

	return 0;
}

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

int Gcd(int a, int b)
{
	//??????????????????????????????
	if (a < b) swap(a, b);
	if (b == 0) return a;
	return Gcd(a % b, b);
}

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

	return 0;
}

C++: #include <iostream>

using namespace std;

void gcd_lcm(int, int);

int main() {

	int a, b;

	while(cin >> a >> b) {
		if(a>2000000000||b>2000000000)
			continue;
		gcd_lcm(a, b);
	}

}

void gcd_lcm(int a, int b) {
	int i=2, gcd=1;
	if(a<b) {
		int t=a;
		a=b;
		b=t;
	}

	while(i<=a) {
		if(a%i==0&&b%i==0) {
			gcd*=i;
			a/=i;
			b/=i;
			continue;
		}
		i++;
	}
	
	cout << gcd << " " << a*b*gcd << endl;
}

C++: #include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)


using namespace std;


int lcd(int a, int b){
	if (a < b) swap(a, b);
	int c;

	while (b != 0){
		c = a%b;
		a = b;
		b = c;
	}
	return a;
}



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

C++: #include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

template<class T>
inline bool chmax(T& a, T b){if(a<b){a=b;return true;} return false;}

template<class T>
inline bool chmin(T& a, T b){if(a>b){a=b;return true;} return false;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll nCrmod(ll n,ll r){ll x=1,y=1; rep(i,r){x=x*(n-i)%mod; y=y*(i+1)%mod;} return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

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

C++: 
#include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
   if(b!=0)return GCDi(b,a%b);
    return a;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){
    while(~scanf("%d%d",&n,&m)){
        int q,r;
        if(n > m){q = GCDi(n,m);r =LCMi(n,m);}
        else if(n > m){q = GCDi(m,n) ;r =LCMi(m,n);}
        else {
            q =n;r = n;
        }
        cout<<q<<" "<<r<<endl;
    }return 0;
}

C++: ///
// File:  0005.cpp
// Author: ymiyamoto
//
// Created on Wed Nov  8 22:03:57 2017
//

#include <cstdint>
#include <iostream>

using namespace std;

uint64_t gcd(uint64_t a, uint64_t b)
{
  if (a < b) return gcd(b, a);
  if (b == 0)
    return a;
  else
    return gcd(b, a - b);
}

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

int32_t main()
{
  while (true) {
    uint64_t a, b;
    cin >> a >> b;
    if (cin.eof()) break;
    uint64_t g = gcd(a, b);
    cout << g << " " << lcm(a, b, g) << endl;
  }

  return 0;
}

C++: #include<iostream>
int a,b,t;int g(int a,int b){return a<b?g(b,a):(!b?a:g(b,a%b));}main(){for(;std::cin>>a>>b;std::cout<<(t=g(a, b))<<' '<<(a/t)*b<<"\n");}

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

long long gcd(long long a,long long b)
{
	return b==0 ? a:gcd(b,a%b);
}

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