Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(cin>>a){
        cin>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
}
int a,b;

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

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

//最小公約数
int gcd(ll a,ll b){
    if( a==0 || b==0)
          return 0;
            while(a != b){
                  if(a > b) a= a-b;
                      else b=b-a;
                        }
                          return a;
}

//最小公倍数
int lcm(ll m,ll n){
    if(m==0 || n==0)
          return 0;
            return m/gcd(m,n)*n;
}

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

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


int main()
{
	int i;
	long int a,b, def_a, def_b;
	deque<long> soinnsu_a;
	while( cin >> def_a >> def_b ) {
		soinnsu_a.clear();
		if( def_a > def_b ) {
			a = def_a; b = def_b;
		}
		else {
			a = def_b; b = def_a;
		}
		//aを素因数分解行う


		while ( a % 2 == 0 ) {
			soinnsu_a.push_back(2);
			a /= 2;
		}
		for( i = 3;;i+=2 ) {
			while( a % i == 0 ) {
				soinnsu_a.push_back(i);
				a /= i;
			}
			if( a ==1 )
				break;
		}
		
		//bとの最小公倍数を求める
		long LCM = 1;
		long GCD = 1;
       deque< long >::iterator it;
        for ( it = soinnsu_a.begin(); it != soinnsu_a.end();  it++) {
			if( b % *it == 0 ) {
				LCM *= *it;
				b /= *it;
			}
		}
		
		GCD = def_a / LCM * def_b;

		cout << LCM << " " << GCD << endl;
	
	}

	return 0;
}

C++: #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{
    if (!b) return a;
    else return gcd(b,a%b);
}

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

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define ALEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long
#define MOD 1000000007

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

int lcm(int a, int b) {
    if(a == 0 || b == 0) {
        cout << "Error" << endl;
        return 0;
    }

    return (a * b / gcd(a, b));
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(16);

  int a, b;
  while(cin >> a >> b) cout << gcd(x, y) << " " << lcm(x, y) << 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;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define debug(n) cout<<"# "<<#n<<": "<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
int lcm(int a,int b)
{
	return a/gcd(a,b)*b;
}

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

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

typedef long long ll;

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

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

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

int main(){
	int x[3], k = 1, a, b;
	
	while(cin >>x[1]>>x[2]){
		if(x[2] > x[1]) swap(x[1], x[2]);
		a = x[1];
		b = x[2];
		while(x[3 - k] != 0){
			x[k] = x[k] % x[3 - k];
			k = 3 - k;
		}
		cout <<x[k]<<" "<<a / x[k] * b<<endl;
		k = 1;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j > 0){
		return gcd(j, i%j);
	}else{
		return i;
	}
	
}

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

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

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

    return gcd(b, a%b);
}

int main(){
    while(true){
        int a,b;
        cin>>a>>b;
        if(cin.eof())
        break;
        int g = gcd(a,b);
        cout << g << ' ' << a/g*b << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>
using std::__gcd;
int main(){
	int x,y;
	while( scanf("%d %d",&x,&y) != EOF ){
		int g = __gcd(x,y);
		printf("%d %d\n",g,x/g*y);
	}
	return 0;	
}