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() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

func lcm(x, y int) int {
	return (x * y) / gcd(x, y)
}

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

C++: #include<stdio.h>

int gcd(long long int a,long long int b);

int main(){
  long long int a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d\n",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

int main()
{
ll a,b;
while(~scanf("%lld %lld",&a,&b)){
printf("%lld %lld",gcd(a,b),(a*b)/gcd(a,b));
}
}

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

long long gcd(long long m,long long n){
	if(m==0||n==0) return 0;
	while(m!=n){
		if(m>n) m=m-n;
		else n=n-m;
	}
	return m;
}

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

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

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b)){
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld\n",a,x/a*y);
}	
return 0;
	}