Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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 <cstdio>
using namespace std;

int main()
{
    int a,b,GCD,LCM=0;
    
    while(cin >> a >> b){
    
    if (a<b) {
        for(int i=1;a>=i;i++){
            if (b % i == 0 && a % i == 0) {
                GCD=i;
            }
        }
    }else{
        for(int i=1;b>=i;i++){
            if (b % i == 0 && a % i == 0) {
                GCD=i;
            }
        }
    }
    
    LCM = a*b/GCD;
    
    cout << GCD << " " << LCM << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

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

int main(void)
{
	long long a, b;
	while(cin >> a >> b)
	{
		long long Gcd=gcd(a,b);
		cout << Gcd << ' ' << a*b/Gcd << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    long a,b,tmp;
    while(cin >> a >> b){
        long ab = a * b;
        if(a<b){
            tmp = a;
            a = b;
            b = tmp;
        }
        long r = a % b;
        while(r!=0){
            a = b;
            b = r;
            r = a % b;
        }
        cout << b << " " << ab/b << endl;

    }
}

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

//最大公約数(greatest common divisor)と最小公倍数(least common multiple)を計算する関数
void lcm_gcd(long int a, long int b){
	long int i;
	long int x = 1;
	while(1){
		for(i=2;i < a;i++){
		if(a % i == 0 && b % i == 0){
		a /= i;
		b /= i;
		x *= i;
			}
		}
		if(i == a){
		cout << x  << " " << x * a * b << endl;
		break;
		}
		
		
	}
}
			
int main(){
	long int a, b;
	while(cin >> a >> b){
		lcm_gcd(a,b);
	}
	return 0;
}

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

using namespace std ;

long long a, b, Gcd;

void gcd(int a, int b) {
	if (a < b) swap(a,b);
	while (a % b != 0) {
		a %= b;
		swap(a, b);
	}
	Gcd = b;
}

long long lcm(long long a , long long b) {
	return a * b / Gcd;
}

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

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

int main(){
	long a, b, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;
		lcm=t/gcd;
		printf("%ld %ld\n",gcd, lcm);
	}
 return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

long GCD(long a, long b) {
    if (b % a) return GCD(b % a, a);
    else return a;
}

long LCM(long a, long b) {
    return a / GCD(a, b) * b;
}

int main() {
    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() {
	int a, b, A, B;
	int LCM = 0;	//最小公倍数
	int GCD = 0;	//最大公約数
	while (cin >> a >> b) {
		if (a < b) {
			int temp = a;
			a = b;
			b = temp;
		}
		A = a, B = b;
		while (a%b != 0) {
			int r = a % b;
			a = b;
			b = r;
		}
		GCD = b;
		LCM = A * (B / GCD);
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b, int gcd);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b, gcd);
    std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

int l(int a, int b, int gcd){
  return a*b/gcd;
}

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

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}
int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
	}
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int GCD(int a,int b)
{
	if (a%b==0)
		return b;
	else
		return GCD(b,a%b);
}
int cmp(const void *a,const void *b)
{
	return *(int*)b-*(int*)a;
}
int main()
{
	int a[2],gcd,lcm;
	while(cin>>a[0]>>a[1])
	{
		if (cin.eof())break;
		qsort(a,2,sizeof(int),cmp);
		gcd=GCD(a[0],a[1]);
		lcm=(a[0]*a[1])/gcd;
		cout<<gcd<<' '<<lcm<<endl;
	}
	return 0;
}

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

//?????§??¬?´???°
int gcd(int m, int n){
	if ((m == 0) || (n == 0)) return 0;


	while ((m != 0) && (n != 0)){
		m > n ? m = m%n : n = n%m;
	}
	if (m == 0) return n;
	else return m;
}

//????°???¬?????°
int lcm(int m, int n){
	if ((m == 0) || (n == 0)) return 0;

	return m*n / gcd(m, n);
}



int main()
{
	long long int a, b, n, m;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		n = gcd(a, b);
		m = a * (long long int)(b / n);
		cout << n << " " << m << endl;
	}

	return 0;
}

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

int saidai(int a,int b){
	

	while(a !=b){
		if(a>b){
			a -=b;
		}
		else{
			b -=a;
		}
	}
	
	return a;
}

int main(){
	int a,b,c,d;
	cout<<"atai1=";
	cin>>a;
	cout<<"atai2=";
	cin>>b;

	c=saidai(a,b);
	d=a*b/c;
	cout<<c<<" "<<d;
	return 0;
}

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

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

int LCM(int a, int b){
	return a / GCD(a, b) * b;
}

int main()
{
	int a,b;
	while(cin >> a >> b){
		
		cout << GCD(a,b) << " " << LCM(a,b) << endl;
	}
}

C++: 	//PCK2003////
#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==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void) {
	int a, b, G, R, L, r;
	while (cin >> a >> b) {
		R = a;
		L = b;
		int tmp;
		if (b > a) {
			tmp = a;
			a = b;
			b = tmp;
		}
		while (1) {
			r = a%b;
			if (r == 0)break;
			a = b;
			b = r;
		}
		G = b;
		R = R / G;
		L = L / G;
		cout << G << " " << R*L * G << endl;
	}
	return 0;
}