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

int main() {
    unsigned long a, b, c, d, e;
    unsigned long kpk, fpb;
    while ( scanf("%ld %ld", &a, &b) != EOF ) {
          c = a;
          d = b;
          while ( c%d != 0 ) {
                e = c % d;
                c = d;
                d = e;
          }
          fpb = d;
          kpk = (a / fpb ) * b;
          printf("%ld %ld\n", fpb, kpk);
    }
    return 0;
}

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

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

int main()
{   
    long int a, b, c;
    while (scanf("%ld", &a) != EOF) {
        scanf("%ld", &b);
        c = a * b;
        while (a != b) {
            if (a > b)
                a = a - b;
            else
                b = b - a;
        }
        printf("%ld ", a);
        printf("%ld\n", c / a);
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
    long long a, b, n, s, k=0, i=0, c;
    while(cin >> c>> b){
        a=max(c, b);
        b=min(c, b);      
    for(i=b; i>=1;i--){
             if(b%i==0 && a%i==0)
             break;    
    }
    cout<<i<<" "<<(a*b)/i<<endl;
    }
    return 0;
}

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

int gcd(int a,int b){
	int maxa[2000000000],maxb[2000000000],GCD,i,j;
	
	for(i=2;i<a;i++){
		if(a%i == 0){
			a = a/i;
			for(j=0;j<a;j++)
				maxa[j] = i;
		}
	}
	for(i=2;i<b;i++){
		if(b%i == 0){
			b = b/i;
			for(j=0;j<b;j++)
				maxb[j] = i;
		}
	}
	for(j=0;j<a||j<b;j++){
		if(maxa[j] == maxb[j])
			GCD = maxa[j];
	}
	
	return GCD;
}

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<stdio.h>

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

int LCM(int x,int y)
{
	for(int i=1;i<=y;i++)
	{
		if((x*i)%y==0)
			return x*i;
	}
	return x*y;
}

int main()
{
	int x,y;
	scanf("%d%d",&x,&y);
	if(x>y)
	{
		int temp=y;
		y=x;
		x=temp;
	}
	printf("%d %d",GCD(x,y),LCM(x,y));
}

C++: #include <iostream>
long gcm(long a,long b){
    if (b==0) return a;
    return gcm(b,a%b);
}
 
int main(void){
    long a,b,x;
    while (std::cin>>a>>b){
        x=gcm(a,b);
        std::cout<<x<<" "<<a/x*b<<"\n";
    }
}

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

koubai=(big*small)/kouyaku;

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

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

std::uint32_t calc_gcd(std::uint32_t a, std::uint32_t b)
{
	if (a % b == 0) {
		return b;
	}
	return calc_gcd(b, a % b);
}

int main()
{
	std::uint32_t a, b;
	while (std::cin >> a >> b) {
		std::uint32_t const gcd = calc_gcd(std::max(a, b), std::min(a, b));
		std::uint32_t const lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

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

int main(void);
unsigned int gcd(unsigned int x, unsigned int y);
unsigned int lcm(unsigned int x, unsigned int y);

int main(){
	int dataset_count = 0;
	unsigned int first_num = 0;
	unsigned int second_num = 0;

	std::vector<unsigned int> first_num_vector;
	std::vector<unsigned int> second_num_vector;

	//while (dataset_count < 2){
		//std::cin >> first_num >> second_num;
	while ((std::cin >> first_num >> second_num)/* || (dataset_count < 50)*/){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (unsigned int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
unsigned int gcd(unsigned int x, unsigned int y)
{
	unsigned int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
unsigned int lcm(unsigned int x, unsigned int y)
{
	unsigned int rtn;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	rtn = (x / gcd(x, y)) * (y / gcd(x, y));

	return rtn * gcd(x, y);
}

C++: #include <iostream>

inline int calcGcd(int x,int y){
	while(x % y != 0){
		int num = x % y;
		x = y;
		y = num;
	}
	return y;
}

inline int calcLcm(int x,int y){
	return x / calcGcd(x,y) * y;
}

int main(){
	int a,b;
	while(std::cin >> a >> b)
		std::cout << calcGcd(a,b) << " " << calcLcm(a,b) << std::endl;
}

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

int gcd(int a,int b)
{
	int t;
	while (b) {
		t = a % b;
		a = b;
		b = t;
	}
	return a;
}
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", gcd(a,b), lcm(a,b));
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
long long a,b;
void yakusuu (int i,int j){
	int I=i;
	int J=j;
	while(i>=0){
	     while(i<j){
		       j=j-i;
	      }
	     while(j<i){
		       i=i-j;
	     }
         if(i==j){
		    cout<<i<<" " ;
		    break;
	     }
	 }
	     cout<<I/i*J<<endl;
}
int main(){
	while(cin>>a>>b){
	    yakusuu(a,b);
    }
	 
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	unsigned long long a, b;
	while (cin >> a >> b){
		unsigned long long gcd, lcm;
		unsigned long long c, d;
		c = max(a, b);
		d = min(a, b);
		while (true){
			if (c % d == 0) {
				break;
			}
			else{
				gcd = c%d;
				c = d;
				d = gcd;
			}
		}
		lcm = a*b / gcd;
		cout << gcd <<' '<< lcm << endl;
	}
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans = 0;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = (b / 2); i > 0; i--)
		{
			if (a%i == 0 && b%i == 0) {
				maxans = i;
				break;
			}
		}
		for (long long int i = 1; i <= a; i++)
		{
			if ((i*b) % a == 0) {
				minans = i*b;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}