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 <utility>

using namespace std;

int p_cal_gcd(int big, int small)
{   if(small == 0) return big;
    else return p_cal_gcd(small, big % small);
}

int cal_gcd(int a, int b)
{
    return a > b ? p_cal_gcd(a, b) : p_cal_gcd(b, a);
}

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

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

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

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

C++: #include <cstdio>
	int m, n;
int GCD(int m, int n)
{
    while( 1 )
    {
        m = m % n;
		if( m == 0 )
			return n;
		n = n % m;

        if( n == 0 )
			return m;
    }
}
int LCM( int m, int n )
{
		
	return ((m / GCD(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main()
{
	while(scanf("%d%d",&m,&n)!=EOF)
	{

		printf("%d %d\n",GCD(m,n),LCM(m,n));
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	for (;;){
		cin >> a >> b;

		//c
		h = a;
		s = b;
		for (;;){
			r = h % s;
			if (r == 0) {
				c = s;
				break;
			}
			h = s;
			s = r;
		}

		//d
		h = a;
		s = b;
		if (a < b){
			for (;;){
				if ((b % a) == 0){
					d = b;
					break;
				}
				b = b + s;
			}
		}
		else if (a >= b){
			for (;;){
				if ((a % b) == 0){
					d = a;
					break;
				}
				a = a + h;
			}
		}

		cout << c << " " << d << endl;
	}
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = ( a / g ) * b;
		std::cout << g << ' ' << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}else if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}
		}
	}

	return -1;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		//cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include<iostream>
#define nijuoku 2000000000

using namespace std;


int saidaikouyaku(__int64 a, __int64 b){
    int big    = max(a,b);
    int little = min(a,b);
    
    for(__int64 i = little; i > 1; --i){
        if(little % i == 0 && big % i == 0)return i;        
    }
    return -1;
}

int saisyoukoubai(__int64 a, __int64 b){
    
    int big    = max(a,b);
    int little = min(a,b);
    
    for(__int64 i = big; i < nijuoku; i += big){
        if(i % little == 0)return i;        
    }
    return -1;
};


            
int main(){

    __int64 a, b;
    
    while(cin >> a >> b){
        cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl;
	}
	return 0;
}

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

int main(){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b >>;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i=a;
		a=b;
		b=i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i=a;
 a=b;
 b=i;
 }
}
cout >> g >> " " >> seki/g >> endl;

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  long long a,a2,b,b2,R,l;
  cin>>a>>b;
  a2=a;
  b2=b;
  while(1){
    if(b>a){
      R=b-a;
      if(a<R)b=R;
      else{ 
	b=a;
	a=R;
      }
    }
    else{
      R=a-b;
      if(a<R){
	b=a;
	a=R;
      }
      else{ 
	a=b;
	b=R;
      }
    }
    if(R==0)break;
      }
  cout<<a<< ' ';
  l=(a2*b2)/a;
  cout<<l<<endl;
  return 0;
}

C++: #include<stdio.h>

typedef unsigned long long ULL;

ULL gcd(ULL m,ULL n){
	
	return n==0?m:gcd(n,m%n);	
}
ULL lcm(ULL m,ULL n){
	
	return m/gcd(m,n)*n;
}

int main(){
	ULL a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

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

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

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

C++: #include<stdio.h>

int main(void)
{
	int x[1000],x2[1000],y[1000],y2[1000],z[1000],i=0,j=0,gcd[1000]={0},lcm[1000]={0};

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
	   while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   gcd[j]=y[j];

	   lcm[j] = x2[j] * y2[j] / gcd[j];
	   
	   printf("%d %d\n",gcd[j],lcm[j]);
	}
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    long long a, b;
    while(cin >> a >> b){
        long long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
//aoj 0005
using namespace std;
int x,y;
int gcd(int a,int b)
{
	if(b==0)
	{
		return a;
	}else{
		return gcd(b,a%b);
	}
}
int lcm(int a,int b)
{
	return (long long)a*b/gcd(a,b);
}
int main()
{
	while(scanf("%d%d",&x,&y)!=EOF)
	{
		printf("%d %d\n",gcd(x,y),lcm(x,y));
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
long long fpb(long long a, long long b){
	long long ret = 0;
	while(a % b != 0){
		ret = a % b;
		a = b;
		b = ret;
	}
	return b;
}
long long a, b;
int main(){
	while(cin >> a >> b){
		cout << fpb(a, b) << " " << (a*b)/fpb(a, b) << "\n";
	}
	return 0;
}