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 gcd(int x,int y){
  if(x%y==0) return y;
  else{
    int z=x%y;
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main()
{   
    int a, b;
    int c;
    while (scanf("%d", &a) != EOF) {
        scanf("%d", &b);
        c = a * b;
        while (a != b) {
            if (a > b)
                a = a - b;
            else
                b = b - a;
        }
        printf("%d ", a);
        printf("%d\n", c / a);
    }
}

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

using namespace std;
//int solveGCD(int a, int b);

int a, b, tmp;

int solveGCD(int a, int b) {
  return b ? solveGCD(b, a%b) : a;
}

int main() {
  while(1) {
    scanf("%d %d", &a, &b);
    if(a<b) {tmp=a; a=b; b=tmp;}
    int gcd = solveGCD(a, b); 
    printf("%d %d\n", gcd, a/gcd*b);
  }
}

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

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


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

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

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        printf("%d %d\n",g,a);
    }
}

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

int gcd(int x,int y){
	int num;
	while(x % y != 0){
		num = x%y;
		x = y;
		y = num;
	}
	return y;
}


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

C++: #include <cstdio>
typedef long long int64;
int64 gcd(int64 a,int64 b)
{
	return b?gcd(a%b,b):a;
}
int main()
{
	int64 a, b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		int64 g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
}

C++: #include "bits/stdc++.h"
using namespace std;

long long int GCD(long long int a, long long int b) {
    return (b % a == 0) ? a : GCD(b % a, a);
}

long long int LCM(long long int a, long long int b) {
    return (a / GCD(a, b)) * b;
}

int main() {
    long long int a, b;
    while (cin >> a >> b) {
        cout << GCD(a, b) << " " << LCM(a, b) << endl;
    }    
    return 0;
}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

int lcm(int a,int b)
{
	return (a*b) / gcm(a,b);
}

int main()
{
	int a[2];
	int i=0;
	int n;
	while(cin >> n){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		if (i==sizeof(a) / sizeof(a[0]) - 1){
			a[i] = n;
			// cout << "start" << endl;
			// cout << "a[0]=" << a[0] << "a[1]=" << a[1] << endl;
			cout << gcm(a[0],a[1]) << ' ' << lcm(a[0],a[1]) << endl;
			i = 0;
		}
		else {
			a[i] = n;
			i++ ;
		}
	}
	
	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 main(){
	int a, b;
	int i;
	int k;

	while(cin >> a >> b){

		if(a > b){
			i = GCD(a, b);
		}
		else{
			i = GCD(b, a);
		}

		a = a / i;
		b = b / i;

		k = a * b * i;

		cout << i << " " << k << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
typedef long long int LLI;
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
LLI gcd(LLI n,LLI m){
  while(m){
    n=n%m;
    swap(n,m);
  }
  return n;
}
int main(){
  LLI n,m;
  while(cin>>n>>m){
    LLI ans=gcd(n,m);
    cout<<ans<<" "<<ans*(n/ans)*(m/ans)<<endl;
  }
}

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

using namespace std;

typedef long long int llongi;

llongi GCD(const llongi& a, const llongi& b) {
	if (a%b == 0) {
		return b;
	}
	GCD(b, a%b);
}

int main() {
	llongi a, b;
	llongi gcd;
	while (cin >> a >> b) {
		a = max(a, b);
		b = min(a, b);
		gcd = GCD(a, b);
		cout << gcd << " " << a * b / gcd << endl;
	}
	return 0;
}

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

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

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 <cstdio>
#include <algorithm>

using namespace std;

int main() {

	int a, b, c=1, GCD, LCM ,  d ,e;

	while (cin >> a >> b) {
		d = a;
		e = b;
		while (c) {
			c = a % b;
			if (c == 0) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = c;
			}
		}
		d /= GCD;
		e /= GCD;
		LCM = d * e * GCD;

		cout << GCD << " " << LCM << endl;
		c = 1;
	}

	return 0;

}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, K;
VL neg, pos;
VL nmax, pmax;

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

int main() {
    ll a, b;
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << a * b / gcd(a, b) << "\n";
    }
    return 0;
}