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\n", G, L)
	}
}

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

using namespace std;

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


		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 << endl;
		
		a1 = a; b1 = b;
	}
}

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

long int euclid_alg(const long int a, const long int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	long int a,b;
	std::vector<long int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		long int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	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>
#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)!=EOF){
		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 <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;
    while (cin >> a >> b && a != EOF)
    {
        int d = gcd(a, b);
        cout << d << " " << (a / d) * b << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	long long x,y;
	while (cin >> x >> y){
		cout << __gcd(x, y) << ' ' << x*y/__gcd(x, y) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,GCD,LCM,r,xa,xb;
	while(cin>>a>>b){
		xa=a;
		xb=b;
		while(1){
			if(xa>xb){
			xa = xa%xb;
			}
			else{
			xb = xb%xa;
			}
			if(xb=xa){break;
			}
		}
		GCD=xb;
		LCM=(a*b)/xb;
		cout<<GCD<<" ";
		cout<<LCM<<endl;
	}

	return 0;

}

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

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

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

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

int main(){

  int n[2];
  int yaku,bai;
  while(cin >> n[0] >> n[1]){
    sort(n,n+2);
    for(yaku=n[0];1<yaku;yaku--)
      if(n[0]%yaku==0 && n[1]%yaku==0)
	break;

    for(bai=2;bai<=n[0];bai++)
      if((bai*n[1])%n[0]==0){
	bai *= n[1];
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}

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),ans = n/d*m;
		printf("%lld %lld\n",d,n*m/d);
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
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 / GCD(a, b) * b;
}

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

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

int gcd(int a, int b){

int p,q,r;
if(a<b){p=b;b=a;a=p;

}
   while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
   }
   return a;
}

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

C++: #include<iostream>
int e(int a,int b){if(a<b)a^=b^=a^=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("%d %d\n",c,a*b/c))c=e(a,b);}

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

int GCD(int a, int b) {
	int A = 0, B = 0;
	if (a == max(a, b)) {
		A = a;
		B = b;
	}
	else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return GCD(B, A - B);
	return -1;
}

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

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

int GCD(int a,int b);
int LCM(int a,int b);

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

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a / GCD(a, b)) * b);
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/

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

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
   unsigned long int LCM = a;
   GCD = b;
    if( GCD > a )std::swap( a , GCD );
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  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 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;
	}
}

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


#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repback(i,n) for(int i=(int)n-1;i>=0;i--)
#define repa(i,a,n) for(int i=a;i<(int)(n);i++)
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 1e7, MAX_N = 1000000, MAX_M = 1000, MAX_W = 20, MAX_H = 20;
int asc(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

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

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

int main() {
    int n,m;
    while (cin >> n >> m) {
        int a1 = gcd(n, m);
        int a2 = lcm(n, m);
        cout << a1 <<" "<< a2 << endl;
    }

    return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		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;
}