Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
 
 
long long pgcd(long long a,long long b)
{
    return a==0?b:pgcd(b%a,a);
}
 
long long ppcm(long long a,long long b)
{
    return a*b/pgcd(a,b);
}
 
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<pgcd(a,b)<<" "<<ppcm(a,b)<<endl;
    }
}

C++: #include <stdio.h>

int main(void){
	long a,b;
	long m,n;
	while(scanf("%ld %ld",&a,&b) != EOF){
		m = a;
		n = b;
		
		while(m != 0&&n != 0){
			if(m > n){
				m %= n;
			}else{
				n %= m;
			}
		}
		
		if(m > n){
			printf("%ld %ld\n",m,a/m*b);
		}else{
			printf("%ld %ld\n",n,a/n*b);
		}
	}
	return 0;

}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
using namespace std;

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

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

C++: #include <iostream>

using namespace std;

int main() {

	long long a, b;
	long long min, max;

	while (cin >> a >> b) {
		
		//?????§??¬?´???°????±???????
		//?????§??¬?´???°??????????????????????????????????????????????????§??????????????????????????£?????¨????????´??°??????
		max = 1;
		//a,b??????????°???????????????°?????§?????????
		for (long i = 2; i <= a&&i <= b; i++) {
			if (a%i == 0 && b%i == 0) {
				max = i;
			}
		}

		//????°???¬?????°????±???????
		//2,000,000,000?????§?????????
		long long i=1, j=1;
		while (a*i<2000000000&&b*j<2000000000) {
			//cout << "ai=" << a*i << " bj=" << b*j << endl;
			if (a*i == b*j) {
				min = a*i;
				break;
			}
			else if (a*i < b*j) {
				i++;
			}
			else if (a*i > b*j) {
				j++;
			}
			
		}

		cout << max << " " << min << endl;
	}

	return 0;

}

C++: #include<iostream>
using namespace std;
int main()
{
 int nA,nB,i;
  while(cin>>nA>>nB)
  {
    if(nA>=nB)
	 {
	  for(i=nB;;i--)
	   if(nA%i==0&&nB%i==0)
	     {
	    	cout<<i<<" ";
			break;
		 }
	   for(i=nA;;i++)
       if(i%nA==0&&i%nB==0)
	     {
	    	cout<<i<<endl;
			break;
		 }
	 }
	 else
	 {
        for(i=nA;;i--)
	   if(nA%i==0&&nB%i==0)
	     {
	    	cout<<i<<" ";
			break;
		 }
	   for(i=nB;;i++)
       if(i%nA==0&&i%nB==0)
	     {
	    	cout<<i<<endl;
			break;
		 }
	 }
   }
   return 0;
}

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(true){
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b)swap(a,b);
		if(b==1){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

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

using namespace std;

int main(){
    int n, m, a, b, i=2, j=2, g;
    cin >> n >> m;
    
    a=n;b=m;
    while(a!=b){
        if(a<b) a=n*i++;
        else b=m*j++;
    }
    
    g = n*((double)m/a);
    printf("%d %d\n",g,a);
}

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

int main()
{
    long a,b,n=0;
    while(cin >> a >> b){
        if (a>b) {
            n = b;
            while (a % b != 0) {
                b = a % b;
            }
            
            long m = a*n;
            m /= b;
            cout << b << " " << m << endl;
        }
        
        if (b>a) {
            n = a;
            while (b % a != 0) {
                a = b % a;
            }
            
            long m = b*n;
            m /= a;
            cout << a << " " << m << endl;
        }

    }
    
    
}

C++: // 2014/04/27 Tazoe

#include <iostream>
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<stdio.h>
int gcd(int x,int y){
	int r,m;
	if(x < y){
	m=x;
	x=y;
	y=m;
	}
	while(y > 0){
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int main()
{
	long long int a,b,x,n;
	while(scanf("%d%d",&a,&b)!=EOF){
		x=gcd(a,b);
		printf("%d ",x);
		n=(a*b)/x;
		printf("%d\n",n);
	}
	return 0;
}

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

long long LCM(long long c,long long d){
	long long res=d;
	if(c%d!=0)res=LCM(d,c%d);
	return res;
}
int main() {
    clock_t cTimeStart, cTimeEnd;
    cTimeStart = clock();           // 現在時刻
    long long a,b;
    long long lcm;
    while(cin>>a>>b){
    	lcm =LCM(a,b);
       	cout << lcm<<" "<<(a*b/lcm)<<endl;;
    }

    cTimeEnd = clock();           // 現在時刻
//    cout<< "処理時間:" <<(cTimeEnd - cTimeStart)/1000 << "[ms]" << endl;

	return 0;
}

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

int main() {
	int a,b,e,f;
	while(cin>>a>>b){
		int l;
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	break;
	    }
		}
	}
	return 0;
}

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

int main(){
int n,m,a,b,i,N,M;
while(cin>>n>>m){
a=1;
for(i=2;;i++){
N=n%i;
M=m%i;
if(N==0&&M==0){n/=i; m/=i; a*=i; i--;}
if(n<i||m<i)break;}
b=n*m*a;
cout<<a<<" "<<b<<endl;}}

C++: #include<cstdio>
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)==2)
    {
    	long long sum=gcd(a,b);
    	long long num=a/sum*b;
    	printf("%lld %lld\n",sum,num);
	}
    return 0;
}

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

using namespace std;

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

int main(){
  vector<long> a,b;
  long c,d;
  while(cin >> c >> d){
    a.push_back(c);
    b.push_back(d);
  }
  
  for(int i=0; i<a.size(); i++){
    cout << gcd(a[i],b[i]) << " " << lcm(a[i],b[i]) << endl;
  }

  return 0;
}

long gcd(long a, long b){
  long tmp;
  while(a%b != 0){
    tmp = a;
    a = b;
    b = tmp%b;
  }
  return b;
}

long lcm(long a, long b){
  long c=a,d=b;
  while(a != b){
    if(a > b){
      b+=d;
    }else{
      a+=c;
    }
  }
  return a;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd = 1, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 2; a/2 > i;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
      while(m!=n){
  		if (m>n) m = m - n;
  		else n = n - m;
  	}
  	return m;
}
ll lcm(ll m,ll n){
      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<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a,b;
ll gcd(ll m,ll n)
{
    if(m==0)return n;
    if(n==0)return m;
    return gcd(n,m%n);
}
int main()
{
    while(~scanf("%lld%lld",&a,&b))
    {
        ll ans1=gcd(a,b);
        ll ans2=a*b/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}