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<iostream>
#include<algorithm>
using namespace std;

int main(){
	int a, b, min ,max, gcd, lcm;
	
	while(cin >> a >> b){
		
		min = min(a, b);
		max = max(a, b);
		
		for(int i = 0; i < min; i++){
			if(min % i == 0 && max % i == 0) gcd = i;
		}
		
		while(1){
			int i = 1;
			if( (max * i) % min == 0) {
				lcm = max *i;
				break;
			}
			else i++;
		}
		
		cout << gcd <<  " " << lcm << endl;
}

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)
    {
        long long c=a*b;
        return c/gcd(a,b);
    }

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		long long tmp = 0;
		temp_a = a;
		temp_b = b;
		if (temp_a < temp_b){
			tmp = temp_a;
			temp_a = temp_b;
			temp_b = tmp;
		}
		while (temp_a % temp_b != 0){
			r = temp_a % temp_b;
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;


	}

	//getchar();

	return 0;
}

C++: #include <cstdio>
int a,b;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
    while(~scanf("%d%d",&a,&b)){printf("%d %lld\n",gcd(a,b),1LL*a*b/gcd(a,b));}
    return 0;
}

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

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