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;
int main() {
	long long a, b, c,d,e,A,B,C;
	c = 9;
	d = 9;
	e = 9;
	C = 9;
	while (cin >> a >> b) {
		if (a < b) { swap(a, b); }
		A = a;
		B = b;
		while (1) {
			if (c == 0) { break; }
			c = a%b;
			a = b;
			b = c;
		}
		d = A / a;
		e = B / a;
		C = a*d*e;
		cout << a << ' ' << C << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int a, b;
int g, l;

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

int main(void)
{
	while(1){
		if(cin.eof()) break;
		cin >> a >> b;
		
		g = gcd(a, b);
		l = a / g * b;
		cout << g << " " << l << endl;
	}
	return 0;
}

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

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

int main() {
	unsigned long long a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	break;
	    }
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
    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(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        int lcm=(a*b)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <queue>
#include <stack>
#include <list>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <utility>
#include <climits>
using namespace std;

#define print(v) for (int i = 0; i < v.size(); ++i) cout << v[i] << " "; cout << endl;
template <class T>
void printMatrix(vector< vector< T > >& matrix) {
  for (int i = 0; i < matrix.size(); ++i) {
    for (int j = 0; j < matrix[i].size(); ++j) {
      cout << matrix[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector< ii > vii;

const int UNVISITED = -1;
const int VISITED = 1;
const int INF = 1000000005;

vector<vi> AdjMatrix;
vector<int> dfs_num;

long long gcd(long long a, long long b) {
  return (!b) ? a : gcd(b, a % b);
}

long long lcm(long long n, long long m) {
  return (m * n) / gcd(m, n);
}

int main() {
  long long a, b;
  while (cin >> a >> b) {
    long long gcdResult = gcd(a, b);
    long long lcmResult = lcm(a, b);
    cout << gcdResult << " " << lcmResult << endl;
  }
}

C++:  #include <stdio.h>
using namespace std;
 long long int n,m,ans,amari,ahokusa;

 int main(void)
 {
    while(1)
    {
         scanf("%lld%lld",&n,&m);
         ans  = n*m;
         if(n < m)
         {
             ahokusa = n;
             n = m;
             m = ahokusa;
         }
         amari = n % m;
         while(amari != 0)
         {
            n = m;
            m = amari;
            amari = n % m;
         }
         ans = ans / m;
         printf("%lld %lld\n",m,ans);
    }

     return 0;

 }

C++: #include<stdio.h>

int main(void)
{
	int num[2],koyak,escape;
	
	long int i;
	
	long int kobai;
	
	while(scanf("%d %d",&num[0],&num[1]) != EOF )
	{
		kobai = 0;
		koyak = 0;
		
		if(num[0] < num[1])
		{
			escape = num[0];
			num[0] = num[1];
			num[1] = escape;
		}
		
		for(i = num[1] ; i >= 1 ; i--)
		{
			if(0 == num[0] % i && 0 == num[1] % i)
			{
				koyak = i;
				break;
			}
		}
			
		i = 1;
		
		while(1) 
		{
			if(0 ==( num[0] * i ) %  num[1])
			{
				kobai = num[0] * i;
				break;
			}
			
			i++;
		}
		
		printf("%d %ld\n",koyak,kobai);
		
	}
	
	return 0;
}

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

using namespace std;

int getcom(int x, int y) {
	int no = 2;

	while (true) {
		if (no > x || no > y) {
			return 1;
		}

		if (x % no == 0 && y % no == 0) {
			x = x / no;
			y = y / no;
			return no * getcom(x, y);
		}
		no++;
	}
}

int main(void) {
	int a, b;

	vector<string> v;
	while (cin >> a >> b) {
		int com_div, com_mlt;

		com_div = getcom(a, b);
		com_mlt = (a / com_div) * (b / com_div) * com_div;
		stringstream ss;
		ss << com_div << " " << com_mlt;
		v.push_back(ss.str());
	}

	for (int i = 0; i < v.size(); i++) {
		cout << v[i] << endl;
	}

	return 0;
}

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

typedef long long ll;

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

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

LL gcd(LL a, LL b){
    while(b){
        LL tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}
int main(){
    LL a, b;
    while(~scanf("%d%d", &a, &b)){
        printf("%lld %lld\n", gcd(a, b), (a * b / gcd(a, b)));
    }
    return 0;
}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

LL gcd(LL a, LL b) {
	return b != 0 ? gcd(b, a % b) : a;
}

LL lcm(LL a, LL b) {
	return a * b / gcd(a, b);
}



int main() {

	LL a, b;
	while (cin >> a) {
		cin >> b;

		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
	
	return 0;

}