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

C++: #include<iostream>
using namespace std;
int a,b;
int gcd(int x,int y){
    a=x;
    b=y;
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
   
    while(cin>>x>>y){
        int c=gcd(x,y);
        int lcm=(x*y)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

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

int gcd(int u, int v)
{
  int r, z;

  if(v > u)
  {
    z = u;
    u = v;
    v = z;
  }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

  while(scanf("%d %d", &a, &b) != EOF)
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}

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

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