Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

func getGCD(a, b int) int {
	if b == 0 {
		return a
	}
	return getGCD(b, a%b)
}

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

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

int main(){
	long a, b;
	while (cin >> a >> b){
		long c = a;
		long d = b;
		while (1){
			if (c < d) swap(c, d);
			// c >= d
			if (c % d == 0){
				cout << d << " " << (a * b) / d << endl;
				break;
			}
			else{
				long tmp = c;
				c = d;
				d = tmp % d;
			}
		}
	}
	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",gcd, lcm);
    //std::cout << gcd << " " << lcm << 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 <iostream>
using namespace std;
 
int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

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

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	cin >> a >> b;
	a1 = a;
	b1 = b;
	while (1)
	{
		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;
		cin >> a >> b;
		a1 = a; b1 = b;
	}
}

C++: #include <iostream>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		long int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; ++i){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << " " << minmul << std::endl;

	}

	return 0;
}

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

int main()
{
	long int a,b,i,min,max,x,y; //x最大公約数 y最小公倍数

	while(cin>>a>>b){
		x=y=0;
		if(a<b){
			min=a; max=b;
		}else{
			max=a; min=b;
		}

		for(i=min,x=0; x==0; i--){
			if(a%i==0 && b%i==0) x=i;
		}
		for(i=max,y=0; y==0; i++){
			if(i%a==0 && i%b==0) y=i;
		}

		cout<<x<<" "<<y<<endl;
	}
}

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",gcd, lcm);
    //std::cout << gcd << " " << lcm << 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 <iostream>
#include <vector>
using namespace std;

int main(){
		int a, b;
		while(cin >> a >> b){
				int gcd;
				vector<int> divisor_a;
				vector<int> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				cout << gcd << " " << a * b / gcd << endl;
		}
		return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

lld gcd(lld x,lld y)
{
	if (y == 0)
	{
		return x;
	}
	return gcd(y,x%y);
}

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << endl;
		cout << n * m / sol << 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;
	while(cin >> a >> b){
		while(!(((a > 0)&&(a <= 2000000000))&&((b > 0)&&(b <= 2000000000)))){
			cout << "wrong value\n";
			cin >> a >> b;
		}
		cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}
    return 0;
}

//Greatest Common Divisor
int gcd(int a, int b){
	while(a != b){
		if(a > b) a = a - b;
		else b = b - a;
	}
	return a;
}

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

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){
long a,b,r;
while(scanf("%ld %ld",&a,&b) != EOF){
	
	long c=a*b;
			
	if(b>a){r=a; a=b; b=r;}

	while(1){
	r=a%b;
	if(r==0) break;
	a=b; b=r;		
	}
	printf("%ld %ld\n",b,c/b);
}
return 0;		
}

C++: #include "stdio.h"

int main()
{
	int a, b, x, y;

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = a-b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include<stdio.h>

long gcd(long a,long b);

int main(){
  /*
  int a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;

  while(fscanf(stdin,"%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
    printFunc(a,b,c,d,e,f);
  }
  */

  long a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{

double x,y,r,a,b;

cin>>x>>y;
a=x;
b=y;
while(x%y!=0)
{
r=x%y;
x=y;
y=r;
}
cout<<y<<" "<<a*b/y<<endl;
return 0;
}

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

int main() {
	long a,b;
	long c= a,d = b;
	while (cin>>a>>b){
	while(true){
		if(c%d == 0)break;
		d = c % d;
		c = d;
	}
	}cout<<d<<" "<<a*b/d<<endl;
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << a * (b / GCD) << std::endl;
    }    

    return 0;
}

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

int gcd(int a, int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x,y,z,lcm;
while(x!=0||y!=0){
scanf("%d%d",&x,&y);
z=gcd(x,y);
lcm=(x*y)/z;
printf("%d %d\n",z,lcm);
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long int ll;
void solve(ll a ,ll b)
{
    ll a1=a,b1=b,t;
    while(b1!=0){//cout<<a1<<" ! "<<b1<<endl;
        t=b1;
        b1=a1%b1;
        a1=t;

    }
    cout<<a1<<" "<<a*b/a1<<endl;
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        if(a<b)swap(a,b);
        solve(a,b);
    }
    return 0;
}