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>
using namespace std;

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

int main()
{
  int a, b, lcm, gcd;

  while (cin >> a >> b){

    if (a > b){
      int c = a;
      a = b;
      b = c;
    }

    lcm = LCM(a, b);
    gcd = a / lcm * b;

    cout << lcm << " " << gcd << endl;
  }
}

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

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int a, b;
	while (cin >> a >> b){
		int i, GCD, LCM;
		GCD = 0;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a || i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

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

int main(){
int a;
int b;
int c;
int d;
int e;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a&b;
a=b;
b=c;
if(b=0){break;}
}
cout << a <<" ";
cout << (d*e)/a <<endl;}}

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		printf("%d\n",a*b);
		B = b;

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		m = a / b;
		m *= B;
		printf("%d\n",m); 
	}

	return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

void func()
{

	int a,b, g, l;
	while (cin >> a >> b, !cin.eof())
	{
		int d[2] = { max(a, b), min(a, b) };
		while (d[1] != 0)
		{
			d[0] %= d[1];
			swap(d[0], d[1]);
		}
		g = d[0];

		l = max(a, b) / g*min(a, b);
		cout << g << space << l << endl;
	}
}

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

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

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

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%d %d",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


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

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

int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF){
		
		printf("%d %d\n",gcd(a,b),lcm(a,b));
		
	}
}

C++: #include <iostream>
#include <cmath>
int GCD(int a, int b) {
	while (b != 0) {
		int r = a%b;
		a = b;
		b = r;
	}
	return a;
}
int main() {
	int a, b;
	while (std::cin >> a >> b) {
		int gcd = GCD(a, b);
		int lcm = round((double)a/gcd*b);
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long n, m;
long long getGCD(long long a, long long b) {
  if (b == 0) return a;

  return getGCD(b, a % b);
}
int main() {
  freopen("in", "r", stdin);
  while (cin >> n >> m) {
    long long lcm, gcd;
    if (n < m) swap(n, m);
    gcd = getGCD(n, m);
    lcm = n * m / gcd;
    //cout << "debug" << endl;
    cout << gcd << " " << lcm << endl;
  }
  return 0;
}

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

using ULLint = unsigned long long int;

int Egcd(ULLint x, ULLint y) {
	if (y == 0) return x;
	return Egcd(y, x % y);
}

int Glcd(ULLint x, ULLint y, int gcd) {
	return x * y / gcd;
}

int main() {
	ULLint a, b;
	while (cin >> a >> b)
		cout << Egcd(a, b) << " " << Glcd(a, b, Egcd(a, b)) << endl;
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(true){
        cin>>a>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
   
    
    
    
return 0;
}

C++: #include <stdio.h>

int gcd(int m, int n)
{
  if(m<n){
    int tmp = m;
    m = n;
    n = tmp;
  }

  while(1){
    if(n==0){
      return m;
    }

    int tmp = n;
    n = m%n;
    m = tmp;
  }
}

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

int main(void)
{
  int a,b;
  while(scanf("%d %d", &a, &b) != EOF){
    printf("%d %d\n", gcd(a,b), lcm(a,b));
  }

  return 0;
}