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 <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>

using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;

struct gg{ Int v, a, b; };

gg dp[1100][1100];
Int a[1100];
Int b[1100];

Int gcd(Int x, Int y){
	return x%y ? gcd(y, x%y) : y;
}

int main()
{

	Int x, y;
	while (cin >> x >> y){
		Int a = gcd(x, y);
		cout << a << " " << x*y / a << endl;
	}
}

C++: #include "bits/stdc++.h"
using namespace std;
 
long long int gcd(long long int l, long long int r) {
    assert(l > 0 && r > 0);
    if (l > r)return gcd(r, l);
    else {
        const long long int num = r%l;
        if (num) {
            return gcd(l, num);
        }
        else {
            return l;
        }
    }
}
long long int lca(long long int l, long long int r) {
    return l / gcd(l, r)*r;
}
int main() {
    long long int a, b;
    while (cin >> a >> b) {
        cout << gcd(a, b) << " " << lca(a, b) << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    long long int num1 , num2, gcd , res, lcm;
    while(scanf("%lld%lld",&num1,&num2)!=EOF){

        res = num1 * num2 ;
        while(num1 != num2){
            if(num1 > num2)
                num1 = num1 - num2 ;
            else
                num2 = num2 - num1 ;
        }
        gcd = num1 ;
        lcm = res / gcd ;
         printf("%lld %lld\n", gcd, lcm);
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <list>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cfloat>
#include <climits>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <numeric>
#include <functional>
#include <utility>
#include <iomanip>
#include <iterator>
#include <stack>
#include <limits>
#include <sstream>
#include <fstream>
#include <ostream>
#include <bitset>
#include <queue>
#include <ctime>
#include <utility>

#define ms(a,n) (memset(a,n,sizeof(a)))
#define msv(a,v,n) for(int _a;_a<=n;_a++) a[_a]=v;
#define all(res) res.begin(),res.end()
#define mp(a,b) (make_pair(a,b))
#define pb(n) push_back(n)
#define mod 1000000007

using namespace std;

template<class T1> void deb(T1 e){cout<<e<<'\n';}
template<class T1,class T2> void deb(T1 e1,T2 e2){cout<<e1<<" "<<e2<<'\n';}
template<class T1,class T2,class T3> void deb(T1 e1,T2 e2,T3 e3){cout<<e1<<" "<<e2<<" "<<e3<<'\n';}
template<class T1,class T2,class T3,class T4> void deb(T1 e1,T2 e2,T3 e3,T4 e4){cout<<e1<<" "<<e2<<" "<<e3<<" "<<e4<<'\n';}
template<class T> inline T gcd(T a,T b) {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<class T> inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

typedef long long ll;
typedef pair< int, int> PII;
typedef vector< int> VI;
typedef vector< vector<int> > VVI;
typedef map< string, int> MSI;

ostream_iterator<int> screen(cout," ");
//copy(all(res),screen);

const int  sz=2*1000*100+10;
const int inf=INT_MAX>>1;
const ll big=(1LL<<62);
const double pi =acos(-1.0);
int dx[]={0,0,1,-1,1,1,-1,-1},dy[]={1,-1,0,0,1,-1,1,-1};
VI res;

ll powermod(ll n,ll p)
{
    ll x=1,y=n%mod;
    while(p)
    {
        if(p&1LL)
            x=(y*x)%mod;
        y=(y*y)%mod;
        p=p>>1LL;
    }
    return x;
}

int main()
{
    //std::ios_base::sync_with_stdio(false);
    ll n,m;
    while(cin>>n>>m)
    {
        cout<<gcd(n,m)<<' '<<lcm(n,m)<<endl;
    }
    return 0;
}

C++: #include <iostream>

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

        long m = a;
        long n = b;

        while (n != 0) {
            long 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 a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
int main(void){
    int a, b;
    while(cin >> a >> b){
        int s = gcd(a, b);
        cout << s << " " << a*b/s << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<climits>
#include<algorithm>
#include<functional>
#include<iomanip>
#define LL long long
using namespace std;

int a,b;

int gcd(int x,int y){
    if(y==0) return x;
    return gcd(y,x%y);
}

int main(void){
    while(scanf("%d %d",&a,&b)!=EOF){
        int g=gcd(a,b);
        LL l=(LL)a*b/g;
        printf("%d %lld\n",g,l);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
 
long long gcd(long long a, long long b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
 
long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}
 
 
int main(int argc, char *argv[])
{
	long long a, b;
	while (cin >> a >> b)
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
 
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, lcm;

  while(scanf("%d %d", &a, &b))
  {      
    lcm = b/gcd(a,b)*a;
    printf("%d %d\n", gcd(a,b), lcm);
  }

  return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        t=d(n,m);
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

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

int gcd(int x, int y)
{
    if(x < y){
        std::swap(x, y);
    }
    while(y > 0){
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int lcm(int x, int y)
{
    int a = x;
    int b = y;
    while(a != b){
        if(a < b){
            a += x;
        }else{
            b += y;
        }
    }
    return a;
}
int main()
{
    while(true){
        int a, b;
        std::cin >> a >> b;
        if(std::cin.eof()) break;
        std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}