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\n", G, L)
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	lld a,b;
	while(cin >> a >> b;)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

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

int main()
{
	long long a,b;
	while(cin>>a>>b)
	{
		long long numerator=min(a,b);
		long long denominator=max(a,b);
		long long remainder = a % b;
		while(remainder !=0)
		{
			 numerator   = denominator;
			denominator = remainder;
			remainder   = numerator % denominator;
		}
		long long gcd = denominator;
		long long lcm = a * (b / gcd);
		cout<<lcm<<" "<<gcd<<endl;
		/*
		for(long i=min(a,b);i>0;i--)
		{
			if(a%i ==0)
				if(b%i==0)
				{
					cout<<i<<" ";
					break;
				}
		}
		for(long i=max(a,b);i<=2000000000;i+=max(a,b))
		{
			if(i%a ==0)
				if(i%b==0)
				{
					cout<<i<<endl;
					break;
				}
		}*/
	}
}

C++: #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<iostream>
#include<string>
using namespace std;

unsigned int yaku( unsigned int x, unsigned int y ){
	while( x != y ){
		if( x > y )			x -= y;
		else if( x < y )	y -= x;
	}
	return x;
}

unsigned int bai( unsigned int x, unsigned int y ){
	unsigned int x0=x, y0=y;
	while( x != y ){
		if( x > y )			y += y0;
		else if( x < y )	x += x0;
	}
	return x;
}

int main(){
	unsigned int a, b;
	string line;
	while(1){
		getline( cin, line );
		sscanf( line.c_str(), "%d %d", &a, &b );
		if( line.size() == 0 ){
			break;
		}

		unsigned int max = yaku( a, b );
		unsigned int min = bai( a, b );
		cout << max << " " << min << endl;
	}
}

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

int main(){
	while(true)
	{
	long long int m,n;
	cin >> m;
	if(cin.eof()) break;
	cin >> n;
	long long int l1 = m, l2 = n;
	while(l1 != l2)
	{
		if(l1 > l2) l1-=l2;
		else l2-=l1;
	}
	long long int gcd = m*n/l1;
	cout << l1 << " " << gcd << endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

long long int gcd(long long int m,long long int n){
	if(n == 0) return m;
	return gcd(n,m % n);
}

int main(void){
	long long int a, b;
	while(scanf("%lld%lld",&a,&b) != EOF){
		printf("%lld %lld\n",gcd(a,b),a * b / gcd(a,b));
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
long long GCD(long long a,long long b)
{
    if(a==0&&b==0)
        return 0;
    if(a==0) return 1;
    if(b==0) return a;
    else return GCD(b,a%b);
}
int main()
{
    long long x,y;
    while(cin>>x>>y)
    {
        long long ans1=GCD(x,y);
        long long ans2=(x*y)/ans1;
        cout<<ans1<<" "<<ans2<<"\n";
    }
	return 0;
}

C++: gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a>>b;
	
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << l << " " << g;

	
}

C++: #include<stdio.h>

template <typename T>
T gcd(T a,T b) {
   if(b == 0) return a;
  return gcd(b,a%b); 
}
template <typename T>
T lcm(T a,T b) {
    return a/gcd(a,b)*b;
}


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

    return 0;

}

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

int gcd(int a, int b){
    assert(a>=0 && b >=0);
    if(a < b){
        // return gcd(b,a);
        swap(a,b);
    }
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

int lcm(int a, int b){
    assert(a>=0 && b >=0);
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

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

C++: #include<iostream>
using namespace std;
long long gcd(unsigned long long a,unsigned long long b){
    if(!b)return a;
    return gcd(b,a%b);

}
int main(){
    unsigned long long n,m,c;
    while(cin>>n>>m){
        c = gcd(n,m);
        cout << c << " " << (n*m)/c << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm;
	while(1){
		if (scanf("%d%d",&a,&b)==EOF) break;
		gcd=a;
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=a*b/gcd;
		

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i-=2){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
}	
return 0;
	}

C++: 
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <complex>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;

#define REP(i,s,t) for(int i=(s);i<(t);i++)
#define FILL(x,v) memset(x,v,sizeof(x))

const int INF = (int)1E9;
#define MAXN 100005

string gcd_lcm(ll a, ll b)
{
	if(a > b)
	{
		ll A = a;
		ll B = b;
		ll c;
		while( b!=0)
		{
			c = b; 
			b = a % b;
			a = c;
		}
		stringstream s; 
		s << a;
		s << " ";
		s << A/a*B;
		s << "\n";
		return s.str();
	}
	else
	{
		return gcd_lcm(b, a);
	}
}

int main() 
{
	ll a, b;
	string out;
	while(cin >> a >> b)
	{
		out += gcd_lcm(a, b);
	}
	cout << out;
	return 0;
}