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

using namespace std;

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

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

C++: #include <iostream>

using namespace std;

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

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

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

C++: #pragma warning(disable:4996)
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef int LL;

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

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

int main() {
	LL a, b;
	while (~scanf("%Id%Id", &a, &b)) {
		printf("%Id %Id\n", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1/gcd*a2;
        }
        cout << gcd << " " << lcm << endl;
    }
}

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

void solve(int a,int b){
	int c=29999,numa=0,numb=0;
	numa=a;
	numb=b;
	if(a<b) swap(a,b);
	while(c!=0){
		c=a%b;
		a=b;
		b=c;
	}
	cout<<a<<" "<<numb/a*numa<<endl;
}

int main(){
	int a,b;
	while(cin>>a>>b){
		solve(a,b);
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <limits>
using namespace std;

int main() {
	long long x;
	long long y;
	long long g;
	while (scanf("%I64d %I64d", &x, &y)) {
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

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

using namespace std;

//????°???¬?????°
unsigned int comp_GCD(unsigned int a, unsigned int b){
	while(1){
		unsigned int r;
		r = a % b;
		a = b;
		b = r;
		if(b == 0){
			return a;
		}
	}
	return 0;
}

//?????????
int main() {
	unsigned int a, b;
	vector<unsigned int> result_gcd;
	vector<unsigned int> result_lcm;
	while(cin >> a >> b){
		unsigned int gcd = comp_GCD(a, b);
		result_gcd.push_back(gcd);
		result_lcm.push_back(a * (b / gcd));
	}
	for(unsigned int i = 0; i < result_gcd.size(); i++){
		cout << result_gcd[i] << " " << result_lcm[i] << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

bool is_prime(int n)
{
    if(n<=1)
        return false;
    for(int i=2; i*i<=n; i++){
        if(n%i==0)
            return false;
    }
    return true;
}

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

    return gcd(b, a%b);
}

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

int main(){
    while(1){
        int a,b;
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        cout << gcd(a,b) << ' ' << a/gcd(a,b)*b << endl;
    }
}

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			int s;
			s = a;
			a = b;
			b = s;
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

C++: #include <iostream>
using namespace std;
float LCM(float a,float b)
{
	if(a==b)
	return a;
	else
	{
		if(a>b)
		a-=b;
		else
		b-=a;
		LCM(a,b);
	}
}
int main()
{
	float a,b;
	long c;
	cin>>a>>b;
	while(a!=EOF||b!=EOF)
	{
		c=LCM(a,b);
		if(c>100000)
			cout<<c/10000<<"0000 "<<(a*b/c)/10000<<"0000"<<endl;
		else if((a*b/c)>100000)
			cout<<c<<" "<<(a*b/c)/10000<<"0000"<<endl;
		else
			cout<<c<<" "<<(a*b/c)<<endl;
		cin>>a>>b;
	}
}

C++: #include<iostream>
using namespace std;
int lcm(long long x,long long y);
int gcd(long long x,long long y);
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<lcm(a,b)<<" "<<gcd(a,b)<<endl;
    }

    return 0;
}
int lcm(long long x,long long y)
{
    long long a,i;
    if(x>y) a=y;
    else a=x;
    for(i=a;i>0;i--)
    {
        if(x%i==0 && y%i==0)
        {
            return i;
            break;
        }
    }


}
int gcd(long long x,long long y)
{
    return ((x*y)/lcm(x,y));

}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  scanf("%d%d",&a,&b);
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);


  return 0;
}

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

int main() {
	// your code goes here
	long long a,b;
	long long r;
	long long gcd, lcm;
	while(cin>>a>>b){
		if(a<b){swap(a,b);}
		
		long long c=a , d=b;
		while(true){
		r=c%d;
		if(r==0)gcd=d; break;
		c=d; d=r;
		
		}

	lcm= a*b / lcm;
	
	
	cout << gcd << " " << lcm << endl;	
	}
	return 0;
	
	
}

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

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

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;
  }
}