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 <bits/stdc++.h>
using namespace std;
#define N 2000000000
int main() {
	long long int a,b;
	while(cin>>a>>b){
		int* ahoge;
		int* bhoge;
		ahoge=(int*)malloc(sizeof(int)*N);
		bhoge=(int*)malloc(sizeof(int)*N);
		long long int i,j;
		for(i=2;a>1;i++){
			if(a%i==0){
				int count=0;
				do{
					a=a/i;
					count++;
				}while(a%i==0);
				ahoge[i]=count;
			}	
		}
		for(j=2;b>1;j++){
			if(b%j==0){
				int count=0;
				do{
					b=b/j;
					count++;
				}while(b%j==0);
				bhoge[j]=count;
			}	
		}
		long long int great,least,k;
		great=1;
		least=1;
		for(k=2;k<min(i,j);k++){
			great=great*pow(k,min(ahoge[k],bhoge[k]));
		}
		for(k=2;k<max(i,j);k++){
			least=least*pow(k,max(ahoge[k],bhoge[k]));
		}
		cout<<great<<" "<<least<<endl;
	}
	return 0;
}

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

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

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

C++: #include <bits/stdc++.h>
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 (cin >> a >> b) {
    int gcd = get_gcd(a, b);
    int lcm = a / gcd * b;
    cout << gcd << " " << lcm << endl;
  }
  return 0;
}

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

int main() {
	unsigned int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*(b / gcd)*gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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


long long int gcd(long long int n1, long long n2){

if(n2!=0){
    return gcd(n2, n1%n2);

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

}

C++: #include<iostream>
int main(){for(int a,b,c,d,e,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",c,d/c*e))for(d=a,c=e=b;a%=b;b=c)c=a,a=b;}

C++: #include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;

int gcd(int x,int y){
  //cout << x << ',' << y << endl;
  if(x == 0)return y;
  return gcd(y%x,x);
}

int main(){
  int x,y;
  while(cin >> x >> y){
    int tmp = gcd(x,y);
    cout << tmp  << ' '<< (x)*(y/tmp) << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long n=max(a,b);
	long ans=1;
	for(long i=1;i<=n/2;i++){
		if(a%i==0&&b%i==0)ans=i;
	}
	if(a%n==0&&b%n==0)ans=n;
	return ans;
}

C++: 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <limits.h>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <assert.h>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define rep(i, n) for (int (i) = 0; (i) < (n); (i) ++)
#define rep1(i, n) for (int (i) = 1; (i) <= (n); (i) ++)
#define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define db(x) {cout << #x << " = " << (x) << endl;}
#define dba(a, x, y) {cout<<#a<<" :";FOR(i123,x,y)cout<<setw(4)<<(a)[i123];cout<<endl;}
#define clr(x) memset(x,0,sizeof(x));
#define mp make_pair
#define pb push_back
#define sz(x) int((x).size())
#define endl '\n'
typedef long long ll;
typedef long double ld;
const int INF = INT_MAX;
const ll INFL = LLONG_MAX;
const ld pi = acos(-1);
// const int MOD = ;

ll gcd(ll a, ll b)
{
  while (b != 0)
  {
    ll tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
int main()
{
  ios_base::sync_with_stdio(0); cout.precision(15); cout << fixed; cout.tie(0); cin.tie(0);
  ll a, b;
  while (cin >> a >> b)
  {
    ll g = gcd(a, b);
    cout << g << " " << a * (b / g) << endl;
  }
}

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

using namespace std;

int main()
{
	int  a, b,a1,b1,c,g;
	long l;
	cin >> a>>b;
	a1 = a;
	b1 = b;
	
		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a<b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1/g)*b1;
		cout << g << " " << l;
}

C++: #include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>

using namespace std;

int gcd(int x,int y){
  cout << x << ','<<y << endl;
  if(x == 0)return y;
  return gcd(y%x,x);
}

int main(){
  int x,y;
  while(cin >> x >> y){
    int tmp;
    cout << (tmp = gcd(x,y)) << ' '<< (x)*(y/tmp) << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long int ll;
ll gcm(ll a, ll b) {
  if (b > a) swap(a, b);
  ll r = a % b;
  if (r == 0) return b;
  else return gcm(b, r);
}
int main() {
  ll a, b;
  while (cin >> a >> b) {
    ll g = gcm(a, b);
    ll l = a * b / g;
    cout << g << " " << l << endl;
  }
  return 0;
}

C++: #include <cstdio>

using namespace std;

#define max( a, b ) ( ( a > b ) ? a : b )

int main()
{
	char buf[1024];
	int a, b;

	while ( fgets( buf, sizeof( buf ) - 1, stdin ) != NULL && buf[0] != '\n' )
	{
		sscanf( buf, "%d %d", &a, &b );
		
		for ( int i = max( a, b ) / 2; 1 < i; i-- )
		{
			if ( !( a % i ) && !( b % i ) )
			{
				printf("%d ", i );
				break;
			}
		}

		for ( int i = 1; i * max( a, b ) <= 2000000000; i++ )
		{
			if ( !( a * i % b ) )
			{
				printf("%d\n", a * i );
				break;
			}
		}
	}

	return 0;
}

C++: #include <stdio.h>

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

}

C++: #include<iostream>
int e(int a,int b){while(a%=b)a^=b^=a^=b;return b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%ld %ld\n",c,a/c*b))c=e(a,b);}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  while(cin >> a >> b){
    int g = __gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
}