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<math.h>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		long long a,b;
		cin>>a>>b;
		long long c=a*b;
		long temp;
		if(a<b){temp=a;a=b;b=temp;}
		if(cin.eof()) {break;}
		long q,r;
		while(a%b!=0){
			q=(long long)a/b;		
			r=(long long)a%b;
			a=b;
			b=r;
		}
		cout<<b<<" "<<c/b<<endl;		
	}
	return 0;	
}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
	int a,b;
	while(cin>>a>>b) printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
	return 0;
}

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

int main() {
	int a,b,c;
	while(cin>>a>>b){
		int g=0,l=0;
		if(a<b){
			c=b;
			b=a;
			a=c;
		}
		while(1){
			int i=1;
			if((i*a)%b==0){
				g=i*a;
			}
			if(g==i*a) break;
			i=i+1;
		}
		while(1){
			int i=2;
			if(a%i==0){
				if(b%(a/i)==0){
					l=a/i;
				}
			}
			i=i+1;
			if(l!=0) break;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main(){
  int m,n;
  while(cin>>m>>n){
    cout << gcd(m,n) << ' ' << lcm(m,n) << endl;
  }
}

C++: #include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>

#define dprintf(s,...) printf("%s:%d" s,__func__,__LINE__,__VA_ARGS__)
using namespace std;

typedef pair<int,int> P;

const int N=10000;
long long int a,b;


long long int gcd(long long int x,long long int y){
  if(y==0) return x;
  return gcd(y,x%y);
}

int main(){


  while(1){

    cin>>a>>b;
    if(cin.eof()) break;

    long long int c,d;
    c=gcd(a,b);
    d=a*b/c;
    cout<<c<<" "<<d<<endl;
    
  }

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define MOD 1000000007 //10^9+7
#define INF 1000000000 //10^9

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 g=gcd(a, b);
        cout<<g<<' '<<a/g*b<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){int a,b;while(cin>>a>>b)cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0;}

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

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

int main() {
	unsigned long int a, b; vector<unsigned long int> GCDS; vector<unsigned long int> LCMS;
	while(cin>>a>>b) {
		GCDS.push_back(gcd(a, b));
		LCMS.push_back(a / gcd(a, b)*b);
	}
	for (int i = 0; i < GCDS.size(); i++) {
		cout << GCDS[i] << ' ' << LCMS[i] << endl;
	}
}

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

long long int gcd(long long int a, long long int b){
	long long int tmp;
	if(b>a) {tmp=b;b=a;a=tmp;}

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

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

C++: #include<iostream>
#include<string>
#include <algorithm>
#include<iomanip>
#include<cmath>
using std::cin; using std::string;
using std::cout; using std::endl;
using std::sort;
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;
int main(){
    int a,b;
	 int gcd;
	 int lcm=0;
	while(cin>>a>>b){
	    for(int i=1;i<=b;i++){
		    if(a%i==0 && b%i==0)
			    gcd=i;
	        }
	    lcm=(a/gcd)*(b/gcd)*gcd;
	    cout<<gcd<<" "<<lcm<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n*m/a;
    cout << a << " " << b << endl;
  }
  return 0;
}

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

int main()
{
	long int a,b,i,k;

	while(cin>>a>>b){
		long int x=1, y=0;	//x最大公約数 y最小公倍数
		long int large ,small;

		//最小公倍数を求める処理
		if(a<b){small=a; large=b;}
		else{small=b; large=a;}
		for(i=large ;y==0 ;i+=large){
			if(i%small==0) y=i;
		}
		
		//最大公約数を求める処理
		long int ans[100];
		i=2; k=0;
		while(a>i && b>i){
			if(a%i==0 && b%i==0){
				ans[k]=i;
				a/=i; b/=i;
				k++;
			}else{
				i++;
			}
		}
		for(i=0 ;i<k ;i++) x*=ans[i];

		cout<<x<<" "<<y<<endl;
	}
}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void) {
	int a, b;
	cin >> a >> b; 
	cout << gcd(a, b) << " " <<  lcm(a, b) << endl;

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a =< b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

C++: #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
	int r;
	r = a % b;
	if(r==0)
		return b;
	else
		return gcd(b,r);
}
int main(){
	int a,b;
	while(cin >> a >> b){
		int result = gcd(a,b);
		int lcm = a*(b/result);
		cout << result << " " << lcm << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    long long a, b;
    while(cin >> a >> b){
        long long _a = a, _b = b;
        long long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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

int gcd(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	while (x != y) {
		if (x > y) x -= y;
		else y -= x;
	}
	
	return x;
}

int lcm(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	return x / gcd(x, y) * y;
}

int main()
{	
	int x, y;
	
	while(cin >> x >> y) 
		cout << gcd(x, y) << " " << lcm(x, y) << endl;
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b)
{ 
    int r;  
    while((r = a % b) != 0)  
    {      
        a = b;    
        b = r;
        }  
return b
;}
int main(void)
{  
    int a, b, tmp;  
    if (a < b){     
        tmp = b;
        b = a;
        a = tmp;   
        } 
        while(cin >> a >> b) {  
            int lcm = b / gcd(a,b)*a;   
            cout << gcd(a,b) << " " << lcm << endl;    
            
        }   
return 0;
    
}