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 <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1) return b;
  else     return a;
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

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

using namespace std;

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

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

C++: #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int gcd(int x,int y){
	while(y){
		int t=x%y;
		x=y;
		y=t;
	}
	return x;
}
int main()
{
	int n,m;
	while(scanf("%d%d",&n,&m)==2){
		int x=gcd(n,m);
		printf("%d %d\n",x,n/x*m);
	}
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream> 
#include<queue>
#include<vector> 
#include<algorithm>
#include<utility>
#include<cmath>
#define inf 0x3f3f3f3f
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
ll gcd(ll a,ll b){
	ll t;
	while(b!=0){
		t=a;
		a=b;
		b=t%b;
	}
	return a;
}
int main()
{
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		ll Gcd=gcd(a,b);
		ll Lcm=a*b/Gcd;
		printf("%lld %lld\n",Gcd,Lcm);
	} 
    return 0;
}

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

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

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

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

int main(){
	long long a, b, c;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			c = x;
			y = c % y;
			x = c;
		}

		cout << y << " " << (a * b / y) << endl;
	}

}

C++: #include<cstdio>
int gcd(int a,int b)
{
	if(b==0)return a;
	else return gcd(b,a%b);
}
int main()
{
	int n,m;
	while(scanf("%d%d",&n,&m)==2)
	{
		int d = gcd(n,m),ans = n/d*m;
		printf("%d %d\n",d,ans);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d\n", 0, 0);
    } else {
      printf("%d %d\n", m, a * b / m);
    }
  }
  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 <iostream>
using namespace std;

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

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

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

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

C++: #include<cstdio>
long long gcd(long long a,long long b)
{
	if(b==0LL)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(~scanf("%lld%lld",&a,&b))
	{
		long long d=gcd(a,b);
		printf("%lld %lld\n",d,a/d*b);
	}
	return 0;
}

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

long long gcd (long long a, long long b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld %ld", &a, &b) == 2) {
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

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

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

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

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

int main(){
	long long a,b;
	vector<long long*> output;
	while(!cin.eof()){
		cin >> a >> b;
		long long g[2];
		g[0] = gcd(a,b);
		g[1] = a*(b/g[0]);
	}
	vector<long long*>::iterator it = output.begin();
	for(;it != output.end();++it)
		cout << (*it)[0] << " " << (*it)[1] << endl;

	return 0;
}

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

int main() {
	unsigned long a, b, mod, big, small;
	while (cin >> a >> b) {
		if (a > b) {
			int stock = a;
			a = b;
			b = stock;
		}
		big = a;
		small = b;
		while (a % b != 0) {
			mod = a % b;
			a = b;
			b = mod;
		}
		cout << b << " " << big / b * small << endl;
	}
}

C++: #include <iostream>

using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
    return b>0?gcd(b,a%b):a;
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}
int main()
{
    ll a,b;
    while ((cin>>a>>b)>0)
    {
        ll GCD=gcd(a,b);
        cout<<GCD<<" "<<a/GCD*b<<endl;
    }
    return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		int n=min(a,b);
		if(!(a%n) && !(b%n)){
			gcd = n;
		}else{
			for(int i=n/2; i>=1; i--){
				if(!(a%i) && !(b%i)){
					gcd = i;
					break;
				}
			}
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	long a, b;
	long ans[2];
	while (cin >> a >> b) {
		if (a > b) {
			long temp = a;
			a = b;
			b = temp;
		}

		long i = 1;
		while ( (b * i) % a != 0 ) {
			i++;
		}
		ans[1] = b * i;

		long n = b, m = a, r = 1;

		while (r!=0){
			r = n % m;
			n = m;
			m = r;
		}
		ans[0] = n;

		cout << ans[0] << " " << ans[1] << endl;
	}
}

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

typedef long long LL;

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

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

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

C++: #include<stdio.h>


int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;

		while((i==0)&&(j==0)){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}
		if(i==0){
			y=x*y/j;
			x=j;

		}else{
			y=x*y/i;
			x=i;
		}

		printf("%lld %lld\n",x,y);
	}

	return 0;
}