Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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];
						}
				}
				int lcm = a / gcd * b;
				cout << gcd << " " << lcm << endl;
		}
		return 0;
}

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

using namespace std;

#define Vi vector<int>
#define FOR(i,s,e) for (int i=s; i<e; i++)
#define ITER(v) v.begin(), v.end()

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int64_t a, b;
    int64_t gcd;
    int64_t minval;
    bool iscoprime;

    while (true) {
        cin >> a >> b;
        if (cin.eof()) { break; }
        gcd = 1;
        while (true) {
            iscoprime = true;
            minval = min(a,b);
            FOR(i,2,minval+1) {
                if (a % i == 0 && b % i == 0) {
                    a /= i;
                    b /= i;
                    gcd *= i;
                    iscoprime = false;
                    break;
                }
            }
            if (iscoprime) { break; }
        }
        cout << gcd << " " << gcd * a * b << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	else 
	while(true){
		if(a==0||b==0)cout<<"a#";
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

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

using namespace std;

int main()
{
	int x, y;
	while (~scanf("%d%d", &x, &y)){
		int gcd = __gcd(x, y);
		printf("%d %d\n", gcd, x / gcd * y);
	}
}

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

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

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

C++: #include<iostream>
using namespace std;
int main(){
    int  i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( int j=i;j>0;i-=2){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

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


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

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>
#include <vector>
using namespace std;

struct xy
{
	long long x;
	long long y;
};

int getGCD(int a, int b) {
	if (b != 0)
		return getGCD(b, a%b);
	else
		return a;
}
int main()
{
	int a, b;
	vector<xy> dst;
	while (cin >> a >> b ) {
		int GCD = a > b ? getGCD(a, b) : getGCD(b, a);
		long long LCD = long long(a) * long long(b) / long long(GCD);
		dst.push_back({ GCD ,LCD });
	}
	for (vector<xy>::iterator it = dst.begin(); it < dst.end(); it++)
		cout << (*it).x << " " << (*it).y << endl;
	return 0;
}

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0;
		double product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = (double)x*y;
		//ユークリッドの何とか
		while(x && y){
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)MAX(x,y) << " " << (int)(product/MAX(x,y)) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include<cstdio>

int main() {
	int a, b,c,A,B;

	while (scanf("%d %d", &a, &b) != EOF) {
		A = a;
		B = b;
		while (b != 0) {
			c = a%b;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, A / a*B);
	}
	return 0;
}

C++: /********************************************************************
 * ??£?????´??° a,b ?????\?????????a ??¨ b ????????§??¬?´???°??¨????°???¬?????°???????????????
 * ????????°?????????????????????????????????
 ********************************************************************/
#include <iostream>
#include <cstring>
typedef struct _input_values {
    int a;
    int b;
} INPUT_VALUES;

typedef struct _input_values_list {
    INPUT_VALUES sList[10];
    int effectCount;
} INPUT_VALUES_LIST;

int gcd( int a, int b );    // ?????§??¬?´???°????±???????
int lcm( int a, int b, int g );    // ????°???¬?????°????±???????

using namespace std;

int main()
{
    int i = 0;
    int tA = 0, tB = 0;
    int g = 0, l = 0;
    static INPUT_VALUES_LIST values;

    memset( &values, 0, sizeof(values) );

    while( cin >> tA >> tB ) {
        values.sList[values.effectCount].a = tA;
        values.sList[values.effectCount].b = tB;
        values.effectCount++;
    }

    for ( i = 0; i < values.effectCount; i++ ) {
        g = gcd( values.sList[i].a, values.sList[i].b );
        l = lcm( values.sList[i].a, values.sList[i].b, g );
        cout << g << " " << l << endl;
    }

    return 0;
}

/*  @brief  ?????§??¬?´???°????±???????
 *  @param  [i] a   ???????????????
 *  @param  [i] b   ???????????????
 *  @retval ?????§??¬?´???°
 */
int gcd( int a, int b )
{
    int ret = 0;

    if ( 0 == a || 0 == b ) {
        return 0;
    }

    if ( a != b ) {
        if ( a > b ) {
            a = a - b;
        } else {
            b = b - a;
        }
    } else {
        return a;
    }

    ret = gcd( a, b );

    return ret;
}

/*  @brief  ????°???¬?????°????±???????
 *  @param  [i] ???????????????
 *  @param  [i] ???????????????
 *  @param  [i] ?????§??¬?´???°
 *  @retval ????°???¬?????°
 */
int lcm( int a, int b, int g )
{
    if ( 0 == a || 0 == b ) {
        return 0;
    }

    return ( a * b / g );
}

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

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

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

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



long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=2;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}