Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <utility>
typedef unsigned long ul;

using namespace std;

int gcd(ul a, ul b);

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

int gcd(ul a, ul b){
	ul r;
	while((r = a % b) != 0){
		a = b;
		b = r;
	}
	return b;
}

C++: #include<iostream>
#include<algorithm>
typedef unsigned long long ll;
using namespace std;
ll gcd(ll a,ll b)
{
    if(a<b) swap(a,b);
    if(b==0) return a;
    else if(a&1&&b&1) return gcd(b,(a-b)>>1);
    else if(a&1&&b) return gcd(a,b>>1);
    else if(a&&b&1) return gcd(a>>1,b);
    else return 2*gcd(a>>1,b>>1);
}
int main(void)
{
    ll a,b;
    while(cin>>a>>b) {
        cout<<gcd(a,b)<<' '<<a*b/gcd(a,b)<<endl;
    }
    return 0;
}

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

using namespace std;

int getLCM(int, int);
int getGCD(int, int, int);

int main(int argc, char *argv[]) {
  int x, y;
  vector<int> result;

  while (cin >> x >> y) {
    int lcm = getLCM(x, y);
    int gcd = getGCD(x, y, lcm);
    result.push_back(lcm);
    result.push_back(gcd);
  }
  for (int i = 0; i < result.size()/2; i++)
    cout << result[i*2] << ' ' << result[i*2+1] << endl;
  return 0;
}

int getLCM(int x, int y) {
  int tmp;

  if (x < y) {
    tmp = y;
    y = x; 
    x = tmp;
  }
  while (x % y != 0) {
    tmp = x % y;
    x = y;
    y = tmp;
  }
  return y;
}


int getGCD(int x, int y, int lcm) {
  x /= lcm;
  y /= lcm;
  return x * y * lcm;
}

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

int get_gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int a, b;
  while (~scanf("%d %d", &a, &b)) {
    int gcd = get_gcd(a, b);
    int lcm = a / gcd * b;
    printf("%d %d\n", gcd, lcm);
  }
}

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

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

int YUK(int x, int y){
	int c;
		c = x%y;
		if(c == 0){
			return y;
		}else{
			return YUK(y,c);
		}
}

int main(){
	int a, b;

	while( cin >> a >> b ){
		int d;
		if(a >= b){
			d = YUK(a,b);
			cout << d << ' ' << SKB(a,b,d);

		}else{
			d = YUK(b,a);
			cout << d << ' ' << SKB(a,b,d);
		}
		cout << '\n';
	}

	return 0;
}

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

int main(){
    int a,b;
    
    while(cin >> a >> b){
        
        int g,l;
        int aa,bb;
        g = l = 1;
        
        /* ?????§??¬?´???° */
        aa = a;
        bb = b;
        while(true){
            int tmp = 0;
            
            if(aa % 3 == 0 && bb % 3 == 0){
                aa /= 3;
                bb /= 3;
                tmp = 3;
            }
            else if(aa % 2 == 0 && bb % 2 == 0){
                aa /= 2;
                bb /= 2;
                tmp = 2;
            }
            
            if(g == 0){
                g = tmp;
            }
            else{
                g *= tmp;
            }
            
            if(aa <= 3 || bb <= 3){
                break;
            }
            
            if((aa % 2 != 0 && bb % 2 != 0) ||
               (aa % 3 != 0 && bb % 3 != 0)){
                break;
            }
        }
        
        /* ????°???¬?????° */
        aa = a;
        bb = b;
        while(true){
            int tmp = 0;
            
            if(aa % 3 == 0 && bb % 3 == 0){
                aa /= 3;
                bb /= 3;
                tmp = 3;
            }
            else if(aa % 2 == 0 && bb % 2 == 0){
                aa /= 2;
                bb /= 2;
                tmp = 2;
            }
            
            if(g == 0){
                l = tmp;
            }
            else{
                l *= tmp;
            }
            
            if(aa <= 3 || bb <= 3){
                l *= aa;
                l *= bb;
                break;
            }
            
            if((aa % 2 != 0 && bb % 2 != 0) ||
               (aa % 3 != 0 && bb % 3 != 0)){
                l *= a;
                l *= b;
                break;
            }
        }
        
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b)
{
  if(b == 0) return a;
  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;
  }

  return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
int a,aaa,bbb, b, aa[100], bb[100], r,kazu,m;
kazu = 0;
while (cin >> aaa >> bbb) {
	kazu++;
	m = aaa * bbb;
	a = aaa;
	b = bbb;
	if (a <= b) {
		r = a;
		a = b;
		b = r;
	}
	while (b != 0) {
		r = a % b;
		a = b;
		b = r;
	}
	aa[kazu] = a;
	if (m > 0) {
		bb[kazu] = m / aa[kazu];
	}
	else {
		m = aaa / aa[kazu];
		bb[kazu] = m * bbb;
	}
}
for (int i = 1; i <= kazu; i++) {
	cout << aa[i] << " " << bb[i] << endl;
}
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b;
    while (cin >>a >>b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

int gcd(int a,int b){
    int n;
    if (a>b){
        n=b;
        b=a;
        a=n;
    }
    n = a;
    while(b%a!=0){
        n=b%a;
        a=b;
        b=n;
    }
    return n;
}

int lcm(int a,int b){
    int n = a/gcd(a,b)*b;
    return n;
}

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

typedef long long ll;

void lc(ll a,ll b)
{
	ll m=a,n=b,c;  
    while(b!=0)  
    { 
    	c=a%b; 
		a=b; 
		b=c;
	} 
	printf("%lld %lld\n",a,m/a*n);
}
int main (void)
{
	ll a,b;
	while(scanf("%lld%ulld",&a,&b)!=EOF)
	    lc(a,b);
	return 0;
}

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;
	cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>


long long gcd (long long a, b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld", &a) != EOF) {
    scanf("%ld", &b);
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
typedef long long ll;

using namespace std;

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

int main(){
    ll a,b;
    while(cin>>a>>b){
        ll ans1=gcd(a,b);
        ll ans2=a/ans1*b;
        cout<<ans1<<" "<<ans2<<endl;
    }
    return 0;
}