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

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int gcd = get_gcd(a,b);

        int lcm = (a * b) / gcd;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

int max( int a, int b ) {
	if( a > b ) return a;
	return b;
}

int min( int a, int b ) {
	if( a < b ) return a;
	return b;
}

int main(void){

	unsigned long long int a, b, GCD, LCM;

	while( true ) {
		if( cin.eof() ) break;
		cin >> a >> b;
		GCD = euclid( max( a, b ),min( a, b ) );
		LCM = ( a * b ) / GCD;
		cout << GCD << " " << LCM << 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 << "1" << " " << a << endl;
		}
	}
	return 0;
}

C++: #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;
int main(void) {
	ull a, b;
	while(cin >> a >> b){
		if(a < b){
			ull tmp = a;
			a = b;
			b = tmp;
		}
		ull gcd = 1, lcm = a * b;
		for(int i = 2; i <= b; i++){
			while(a > 0 && b > 0 && a % i == 0 && b % i == 0){
				a /= i;
				b /= i;
				gcd *= i;
			}
		}
		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}
}

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;
    for(i == 2;i <= minimum; i++){
        if(a % i == 0 && b % i == 0) break;
        else if(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*a2/gcd;
        cout << gcd << " " << lcm << endl;
    }
}

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

int gcd(int a,int b) {
	int r;
	while (1) {
	
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;	
	}
	return b;
}

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<3;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(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 calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

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

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 << gcd << " " << 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 <algorithm>
#include <sstream>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

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

	return gcd(b, a % b);
}

int main()
{
	long long int a, b, x;
	while (cin >> a >> b && a != EOF) {
		x = gcd(a, b);
		cout << x << " " << a * b / x << endl;
	}
}

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

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a/gcd*b;

    printf("%ld %ld\n", gcd, lcm);
  }

  return 0;
}

C++: // 2012/11/07 Tazoe

#include <iostream>
using namespace std;

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

	return gcd(b, a%b);
}

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;

		if(cin.eof())
			break;

		int g = gcd(a, b);
		cout << g << ' ' << a/g*b << endl;
	}

	return 0;
}

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

int GCD(int value1,int value2){
    int large,small;
    
    if(value1>=value2){
        large=value1;
        small=value2;
    }else{
        large=value2;
        small=value1;
    }
    
    if((large-small)==0){
        return large;
    }else{
        return GCD(small,large-small);
    }
}

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

C++: #include<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(long long int, long long int);

int main()
{
	long long int a, b, tmp;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%lld %lld\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

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

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() {
  long long a, b;
  while(cin >> a >> b) {
    long long g = gcd(a, b);
    long long  l = a*b / g;
    cout << g << ' ' << l << endl;
  }
}