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>
using namespace std;
int main(void){
    long long int a, b;
    while(cin >> a >> b){
        long long int tmp;
        if(a < b){
            tmp = a;
            a = b;
            b = tmp;
        }

        long long int m = a * b;
        //ユークリッドの互除法を用いて最大公約数を求める
        long long int r = a % b;
        while(r != 0){
            a = b;
            b = r;
            r = a % b;
        }
        long long int gcd = b;

        //続いて、公式を用いて最小公倍数を求める
        long long int lcm = m / gcd;

        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <iostream>

using namespace std;

int gcd(int x, int y) {
	int r;
	if(x == 0 || y == 0) {
		return 0;
	}

	while(x % y != 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

long long int lcm(int x, int y) {
	if(x == 0 || y == 0) {
		return 0;
	}
	return ((x / gcd(x, y)) * y );
}

int main() {
	int x, y;

	while(cin >> x >> y) {
		if(x > y) {
			cout << gcd(x, y) << " " << lcm(x, y) << endl;
		}
		else {
			cout << gcd(y, x) << " " << lcm(y, x) << endl;
		}
	}
}

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

int main(){
		long long a, b, gcd, lcm;
		while(cin >> a >> b){
				vector<long long> divisor_a;
				vector<long long> 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];
						}
				}
				lcm = a / gcd * b;
				cout << gcd << " " << lcm << endl;
		}
		return 0;
}

C++: #include <stdio.h>
#include <cmath>
using namespace std;

int lcm(int max, int min) {
    int multiplier = 1;
    while ((max * multiplier) % min != 0) {
        multiplier++;
    }
    return max * multiplier;
}

int gcd(int max, int min) {
    int r = max % min;
    int x = min;
    while (r != 0) {
        int tmp = r;
        r = x % r;
        x = tmp;
    }
    return x;
}

int main(void) {
    int a, b;
    while (scanf("%d %d", &a, &b)+1)  {
        int min = (a < b)? a : b;
        int max = (a < b)? b : a;
        printf("%d %d\n", gcd(max, min), lcm(max, min));
    }
    return 0;
}

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

int main() {
	long long int a, b, t, aa, bb;

	while (!cin.eof()) {
		cin>>a;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int i;
		if(a>=b)
			i=b;
		else
			i=a;
		while(true){
			if(a%i==0&&b%i==0)
				break;
			i--;
		}
		int keep=i;
		cout<<i<<" ";
		if(a>=b)
			i=a;
		else
			i=b;
		while(true){
			if(i%a==0&&i%b==0)
				break;
			i+=keep;
		}
		cout<<i<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<ctime>
#define RG register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;

#define ll long long 
int main(){
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld ",__gcd(a,b));
		printf("%lld\n",1ll*a*b/__gcd(a,b));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t, c;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		s = *a;
		t = *b;
		c = 1;
		for(int tmp = (*a > *b)? *b : *a, i = 2; i <= tmp; i++){
			while(s%i == 0 && t%i == 0){
				s /= i;
				t /= i;
				tmp /= i;
				c *= i;
			}
		}
		cout << c << " " << ((*a)/c*(*b)) << endl;
	}
	
	return 0;
}

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

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

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a * b / y) << endl;
	}
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a % b);
}
int main(){
    ios::sync_with_stdio(false);
    int a, b;
    while(cin >> a >> b)
        cout << gcd(a, b) << " " << ll(a)*ll(b)/gcd(a, b) << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

pll gcdLcm(ll a, ll b) {
  ll x = a, y = b;
  if (x < y) swap(x, y);
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return pll(x, a*b/x);
}

int main() {
  ll a, b;
  while (scanf("%lld %lld", &a, &b) == 2) {
    pll r = gcdLcm(a, b);
    printf("%lld %lld\n", r.first, r.second);
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	long int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<long int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<long int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(0) << std::endl;	
  	}
	return 0;
}

C++: #include <iostream>

#define LL long long

LL GCD(LL a, LL b) {
	LL
		c = a > b ? a : b,
		d = a < b ? a : b;
	while (c != d) {
		c -= d;

		LL tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

LL LCM(LL a, LL b) {
	return a * b / GCD(a, b);
}

int main() {
	int a, b;
	while (std::cin >> a >> b) {
		std::cout << GCD(a, b) << " " << LCM(a, b) << std::endl;
	}
}

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(){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[50] = {};
	int b[50] = {};
	int g[50] = {};
	int l[50] = {};
	int i = 0;
	while (cin >> a[i] >> b[i]) {
		i++;
	}
	for (int j = 0; j < i; j++) {
		int n, m,aa,bb;
		aa = a[j];
		bb = b[j];
		while (a[j] != b[j]) {

			m = max(a[j], b[j]);
			n =	max(a[j], b[j])  % min(a[j], b[j]);
			a[j] = m;
			b[j] = n;
			
		}
		g[j] = a[j];
		if (g[j] != 0) {
			aa = aa / g[j];
			bb = bb / g[j];
		}
		l[j] = aa * bb * g[j];
		
	}
	for (int k = 0; k < i; k++) {
		cout << g[k] << l[k] << endl;
	}
	return 0;
}

C++: /*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005&lang=jp*/

#include <iostream>

using namespace std;

int gcd(int x,int y){
    if(x<y){
        swap(x,y);
    }
    if(y==0){
        return x;
    }else {
        return gcd(y, x % y);
    }
}

int main(){
    int x,y;
    while(cin>>x>>y){
        long long g=gcd(x,y);
        cout<<g<<" "<<y/g*x<<endl;
    }
    return 0;
}