Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

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

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	cin >> a >> b;
	c = a;
	d = b;
	
	while(c != d){
		if(c < d){
			c = a * i;
			i++;
		}else if(c > d){
			d = b * j;
			j++;
		}
	}
	
	/**********************************/
	
	int e, f;
	int k = 2;
	int l = 2;
	e = a;
	f = b;
	
	while(e != f){
		if(e > f){
			e = a / k;
			k++;
		}else if(e < f){
			f = b / l;
			l++;
		}
	}
	
	
	cout << e << " " << c << endl;
	
	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)
	{
		cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

int main() {
	long a, b;
	while (cin >> a >> b)
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int GCD(int x,int y)
{
	return y==0?x:GCD(y,x%y);
}
int a,b;
int main()
{
	while(~scanf("%d %d",&a,&b))
	{
		if(a<b)
			swap(a,b);
		printf("%d %d\n",GCD(a,b),a/GCD(a,b)*b);
	}
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

C++: #include <iostream>

using namespace std;

int main(){

	long a,b,c,d;

	while(cin>>a>>b){
		c=a;
		d=b;
		while(1){
			if(c>d)c=c-d;
			if(c<d)d=d-c;
			if(c==d){
				cout<<c<<" "<<a*b/c<<endl;
				;break;}
		}}
		


return 0;
}

C++: #include<stdio.h>


int Kouyakusu(int a,int d){

	if((a==0)||(d==0))
		return 0;
	

	while(a != d){

		if(a > d)
			a-=d;
		else
			d-=a;
	}

	return a;

}

int main(void){

	long int a,b;

	long int yaku;

	for(int i=0;i<2;i++){
	scanf("%d %d",&a,&b);

	yaku = Kouyakusu(a,b);

	if(yaku != 0)
		printf("%d %d\n",yaku, (a/yaku)*b);
	else
		printf("0 0\n");

	}
	return 0;

}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long a = 0;
	long long b = 0;
	while(cin >> a >> b)
	{
		long long GCD = 0;
		long long LCM = 0;
		if(a < b)
			swap(a,b);
		long long temp = a * b;
		while(a % b != 0)
		{
			long long t = a % b;
			a = b;
			b = t;
		}
		LCM = b;
		GCD = temp / LCM;
		cout << LCM << " " << GCD <<endl;
	}
	return 0;
}

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

int main() {
	double a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = fmod(a,b);
			}else b = fmod(b,a);
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int gcd(int a,int b){
  
  return b>0 ? gcd(b,a%b):a;

}

int lcm(int a,int b){

  return a/gcd(a,b)*b;

}

int main(){
  int a,b;
  while(cin>>a>>b,a,b){
    cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
  }
}

C++: #include <stdio.h>

int main( ){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < i;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    unsigned int a, b;
    while(cin >> a >> b){
        unsigned int _a = a, _b = b;
        unsigned int gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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

C++: #include <iostream>
#include <algorithm>
#define MAX 50000
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;
			}
		}
	}

	int a, b;
	while (cin >> a >> b){
		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;
				}
			}
		}
		int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

int main() {
	int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*b;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

typedef long long ll;

ll a, b;

ll gcd(ll a, ll b) {
    if(b == 0) return a;
    if(a < b) return gcd(b, a);
    return gcd(b, a % b);
}

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

int main() {
    while(scanf("%lld%lld", &a, &b) != EOF) {
        printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); }

int main() {
    int a, b;
    while (scanf("%d%d", &a, &b) != EOF) {
        const int g = gcd(a, b);
        printf("%d %d\n", g, a/g*b);
    }
    return 0;
}

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