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;
typedef long long ll;
ll GCD(ll a, ll b) {
    return a == 0 ? b : GCD(b%a, a);
} 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll a, b, gcd, lcm;
    while (cin >> a >> b) {
        gcd = GCD(a, b);
        lcm = a * b / gcd;
        cout << gcd << " " << lcm << "\n";
    }

    return 0;
}

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

int gcd(int u, int v)
{
  int r;

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, z;

  while(scanf("%d %d", &a, &b))
  {
    if(b > a)
    {
      z = a;
      a = b;
      b = z;
    }
      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}

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

int gcd(int a, int b) {
  	int q,r;
	while(r!=0){
	q=b/a;
	r=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 <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(1){
    if(a==1) return b;
    else     return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

int l(int a, int b){
  int i = 2;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

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

using namespace std;

long long gcd(long long n1, long long n2)
{
    if(n1<n2) gcd(n2,n1);
    else if(n2==0) return n1;
    else
    {
        return gcd(n2,n1%n2);
    }
}

int main()
{
    long long mGCD,mLCM;
    long long n1,n2;
    while(cin>>n1>>n2)
    {
        mGCD=gcd(n1,n2);
        mLCM=(n1/mGCD)*n2;
        cout<<mGCD<<" "<<mLCM<<endl;
    }

    return 0;
}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

int lcm(int a,int b)
{
	return (a*b) / gcm(a,b);
}

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 && cin >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

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(~scanf("%d%d", &a, &b))
    {
        int a1 = max(a, b);
        int b1 = min(a, b);
        int ans1 = gcd(a1, b1);
        long long  ans2 = a / ans1 * b;
        cout<<ans1<<" "<<ans2<<endl;
    }

    return 0;

}

C++: #include<iostream>

//最大公約数を求めるプログラム(m >= n)
int calcGcd(int m, int n);
//最小公倍数を求めるプログラム
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, x, y;
	
	while(std::cin >> x >> y){
		if(x > y) gcd = calcGcd(x, y);
		else gcd = calcGcd(y, x);
		lcm = calcLcm(x, y, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
}

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

inline int calcLcm(int m, int n, int gcd){
	return m * n / gcd;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		if(b==0)break;
		int tmp=a;
		a=b;
		b=tmp%b;
		if(a%b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int m,int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

int main()
{
	int a, b;
	while (cin >> a >> b) {
		if (a >= b)
			cout << gcd(a, b) << endl;
		else
			cout << gcd(b, a) << endl;
	}
	return 0;
}

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

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
        if(cin.eof()){break;}
    }
}

int gcd(int a,int b){
    int n;
    for (int i=1;i<a;i++){
        if (a%i==0 && b%i==0)
            n = i;
    }
    return n;
}

int lcm(int a,int b){
    int n = a/gcd(a,b)*b;
    return n;
}

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 (1){
		cin >> a;
		cin >> b;
		d = (unsigned long int)GCD(a, b);
		l = a * b / d;
		cout << d << " " << l << endl;
	}
	return 0;
}

C++: #include <iostream>


using namespace std;

int main(){
	int a;
	int b;
	int ii = 1;
	cin >> a >> b;
	for (int i = 0; i <= 2000000000; i++){
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << ii <<  " " <<a * b / ii<< endl;
			break;
		}
		else ii++;

	}

	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
using namespace std;

int LCM(int a, int b) {
	int result = 1;
	int i = 2;
	while(i <= a && i <= b) {
		if (a % i == 0 && b % i == 0) {
			result *= i;
			a /= i;
			b /= i;
		}
		else i++;
	}
	return result;
}

int GCD(int a, int b) {
	int result = 1;

	int lcm = LCM(a, b);

	a /= lcm;
	b /= lcm;

	return a * b*lcm;


}

int main() {
	int a, b, lcd;

	while (cin >> a >> b) {




		printf("%d %d\n", LCM(a, b),GCD(a,b));

	}

	//system("pause");
	return 0;
}

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

C++: //#define _USE_MATH_DEFINES
#include <iostream>
//#include <stdio.h>
//#include <iomanip>
//#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>

using namespace std;

long gcd(long a, long b){
	long A, B, R;

	if (a > b){
		A = a;
		B = b;
	}
	else{
		A = b;
		B = a;
	}

	while (1){
		R = A % B;
		if (R == 0){
			return B;
		}
		else{
			A = B;
			B = R;
		}
	}
}

long lcm(long a, long b){
	long A, B;

	A = a;
	B = b;

	while (1){
		if (A > B){
			B = ceil((float)A / (float)b) * b;
		}
		else{
			A = ceil((float)B / (float)a) * a;
		}

		if (A == B) return A;
	}

}


int main(){

	int n;
	long a, b;
	long gcd_a, lcm_a;


	while (cin >> a >> b){

		gcd_a = gcd(a, b);
		lcm_a = lcm(a, b);

		cout << gcd_a << " " << lcm_a << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j > 0){
		return gcd(j, i%j);
	}else{
		return i;
	}
	
}