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 <iostream>

#define CASE double

using namespace std;

int GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

int main(){
	CASE a, b;
	unsigned long int d, l;
	while (cin >> a >> b){

		d = (unsigned long int)GCD(a, b);
		l = a * b / d;
		cout << d << " " << l << endl;
	}
	return 0;
}

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

int main() {
	int n, m;
	while (2 == scanf("%d%d", &n, &m)) {
		printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
	}
	return 0;
}

C++: #include <stdio.h>
 
int main(){
  
    int buf1[50],buf2[50];
  
    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;
  
    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );
  
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
            }
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    return 0;
}

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

C++: #include<iostream>
#include<cstdlib>
#include<algorithm>

using namespace std;

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

int main(){
	long long a, b;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		int d = gcd(a, b);
		int  lcm = a /d *b;
		cout << d << ' ' << lcm << endl;
	}
}

C++: #include <stdio.h>

int main(){

int i,a,b,p,q,r;

while(scanf("%d",&a)!=EOF){

scanf("%d",&b);

p=a;
q=b;

for(i=0;i<1000;i++){

r = p%q;
if(r==0) break;

p=q; q=r;

}

printf("%d %d\n",q,a*b/q);

}

return 0;
}

C++: #include <stdio.h>
#include<string>
#include<string.h>
#include <math.h>
#include<iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
using namespace  std;


/*
//my header
#include "define.h"
#include "geometry.h"*/

#define MyAbs(a) ((a)>0?(a):-(a))
#define MyEqualDoule(a,b) (MyAbs(a-b)<1e-6)

#define foreach(i,n) for(i=0;i<n;++i)
#define foreachd(i,n) for(int i=0;i<n;++i)
#define printfInt1(n) printf("%d\n",n)
#define scanfInt1(n) scanf("%d",&n)
#define scanfInt2(a,b) scanf("%d%d", &a, &b)
#define scanfInt3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define scanfFloat2(a,b) scanf("%f%f", &a,&b)


void init()
{
#ifdef _WIN32
	freopen("1.txt", "r", stdin);
#endif
}

void func();

int main()
{
	init();
	func();

	return 0;
}

class CNumberTheory
{
public:
	static int gcd(int a, int b)
	{
		int t;
		while (b) {
			t = a % b;
			a = b;
			b = t;
		}
		return a;
	}
	static int lcm(int a,int b)
	{
		return a / gcd(a,b) * b;
	}
};

void func()
{
	int a, b;
	while(~scanfInt2(a,b))
	{
		printf("%d %d\n", CNumberTheory::gcd(a,b), CNumberTheory::lcm(a,b));
	}
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    if(bet!=0)
      les=b%bet;
    if(bet==0)
      max=a;
    else if(les==0)
      max=bet;
    else{
      for(;;){
	ch1=bet%les;
	if(ch1==0){
	  max=les;
	  break;
	}
	bet=les;
	les=ch1;
      }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

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){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
         }
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<cmath>
using std::cout;using std::endl;
using std::cin;
int gcd(int a,int b,int c){
	int i=1;
	int r;
	while(true){
		if(a%i==0 && b%i==0)
			r=i;
		i++;
		if(i==a || i==b)
			break;
	}
	return r;
}
int main(){
  int n,m;
  while(cin>>n>>m){
	  cout<<gcd(n,m,n/2)<<" ";
	  cout<<(n/gcd(n,m,n/2))*(m/gcd(n,m,n/2))*gcd(n,m,n/2)<<endl;
  }
  return 0;
}

C++: #include "iostream"
using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " " << a << endl;
		}
	}
	return 0;
}

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

int gcd(int a, int b) {
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

}

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

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

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

int gcd(int a, int b);

int main()
{
	int a, b;

	while (cin >> a >> b, cin.eof() != true){
		cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
	}

	return (0);
}

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

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

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

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

C++: #include <iostream>
#include <stack>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;

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

	while (cin >> a) {
		cin >> b;
		long long int m = a;
		long long int n = b;
		int r1, r2;
		int gcd, lcm;
		
		if (a < b) {
			c = a;
			a = b;
			b = c;
		}
		r1 = a % b;
		r2 = r1;

		while (r2 != 0) {
			r1 = r2;
			r2 = b % r1;
			b = r1;
		}
		gcd = b;
		lcm = (m * n) / gcd;

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

	}

	return 0;
}