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<cstdio>
#define MAX(x,y) ((x>y)? x:y)
#define MIN(x,y) ((x<y)? x:y)

long long int a,b,g,h;

int f(long long int x,long long int y)
{
	if(y==0) return x;
	else return f(y,x%y);
}

int main()
{
	while(scanf("%ld%ld",&a,&b)!=EOF)
	{
		g = f(MAX(a,b),MIN(a,b)); 
		h = (a/g)*b;
		printf("%ld ",g);
		printf("%ld\n",h);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))

template<typename TYPE>
TYPE gcd(TYPE x, TYPE y){
	TYPE r = x % y;
	if (r == 0.0) return y;
	else return gcd(y, r);
}

template<typename TYPE>
TYPE lcm(TYPE x, TYPE y){
	return x * y / gcd(max(x, y), min(x, y));
}

int main()
{
	long long int x, y;
	while (cin >> x >> y){
		cout << gcd(max(x, y), min(x, y)) << ' ' << lcm(x, y) << "\n";
	}
	cout.flush();
	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/ret_gcd)*j;
		
		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;
	}
	
}

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

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

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

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b;cin>>a>>b;cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#define MAX 500000
using namespace std;

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	long long int a, b;
	while (cin >> a >> b){
		long long int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		long long int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

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

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

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

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

using namespace std;

/*Assumption:a > b*/
int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

/*c is gcd.*/
int lcm(int a, int b, int c) {
  return (a / c) * b;
}

int main() {
  int a, b, c;
  while(cin >> a >> b) {
    //    swap(a, b);
    c = gcd(a, b);
    cout << c << ' ' << lcm(a, b, c) << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: #include<stdio.h>
typedef unsigned long long ullong;

ullong gcm(ullong a,ullong b){
    ullong m = a%b;
    while(m){
        a = b;
        b = m;
        m = a%b;
    }
    return b;
}

int main(){
  ullong a,b,g;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    g = gcm(a,b);
    printf("%lld %lld\n",g,(a*(b/g)));
  }
}

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

int main(void){
    int a,b,c,d,x,ans01,ans02;
    int count;
    while(std::cin >> a >> b && count <= 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b;
 
  while(cin >> a >> b){
    int g = __gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
  return 0;
}

C++: //先辗转相除找gcd再通过gcd求lcm
#include <bits/stdc++.h>

using namespace std;

long long a,b;

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

int main()
{
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		long long yin=gcd(a,b);
		long long ax=a/yin,bx=b/yin;
		printf("%lld %lld\n",yin,ax*bx*yin);
	}
	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int GCD(int a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
int LCM(int a, int b)
{
    return a / GCD(a, b) * b;
}
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a/n*b << endl;
    }
 
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	long long a,b;
	while(cin >> a >> b){
		cout << __gcd(a,b) << " " << a/__gcd(a,b)*b << endl;
	}
}

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

using namespace std;

int main() {
	int  a, b;
	while (cin >> a >> b) {
		cout << __gcd(a, b) << " " << a / __gcd(a, b) * b << endl;
	}

}

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

const int maxn = 1e7+7;
const int INF=0x3f3f3f3f;
typedef long long LL;
LL gcd(LL a,LL b){
return b==0?a:gcd(b,a%b);
}

int main(){

LL a,b;
while(scanf("%lld%lld",&a,&b)!=EOF){
    LL g=gcd(a,b);
    LL lcm=a*b/g;
    printf("%lld %lld\n",g,lcm);
}

return 0;
}

C++: #include<stdio.h>

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

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

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) != EOF){
    printf("%d %d\n", gcd(x, y), lcm(x, y));
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,lcm=0,r,x,y,count=0;
    while(cin>>a>>b){
        count++;
        if(count==50)break;
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}