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 <boost/math/common_factor.hpp>
#include <boost/bind.hpp>
using namespace std;
using namespace boost;
using namespace math;

int main(){
  int a, b;

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

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}
int lcm(long long a, long long b,long long gcmed) {
	return (a*b / gcmed);
}
int main(){
	long long a,b;
	while (cin >> a >> b) {
		long long c = gcd(a, b);
		printf("%lld %lld\n", c, lcm(a, b, c));
	}
}

C++: #include <stdio.h>

int euclid(int a, int b);

int main(void)
{
	int a, b;
	int koyaku, kobai;
	
	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			koyaku = euclid(a, b);
		}
		else {
			koyaku = euclid(b, a);
		}
		
		kobai = a * b / koyaku;
		
		printf("%d %d\n", koyaku, kobai);
	}
	
	return (0);
	
}

int euclid(int a, int b)
{
	int c;
	c = a % b;
	
	if (c == 0){
		return (b);
	}
	
	return (euclid(b, c));
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}

		gcd = x;
		lcm = a * b / gcd;	
	
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <cstdio>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int a,b;
while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a*b/g(a,b));
}

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

int max(int a, int b){
    int c;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    cin >> a >> b ;
    
    cout << max(a, b) << min(a, b) << endl;
    
    return 0;
}

C++: #include<iostream>
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(cin >> a >> b){
    int g = gcd(a,b);
    //lcm == a*b/gcd(a,b)で求まる
    //cout << g << " " << a*b/g << endl;  <-オーバーフローする
    cout << g << " " << a/g*b << endl; // <-オーバーフローしない
  }
}

C++: #include <iostream>

//calc G.C.D(m >= n)
int calcGcd(int m, int n);
//calc L.C.M
inline int calcLcm(int m, int n, int gcd);

int main(){
	int a, b;
	
	while(std::cin >> a >> b){
		int gcd, lcm;
		
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, 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>
#include<iomanip>
using namespace std;

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

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

C++: #include <iostream>
using namespace std;
int main() {
    int a, b;
    while (cin >> a >> b) {
        long long ta = a, tb = b, tmp;
        while (ta != 0) {
            tmp = ta;
            ta = tb % ta;
            tb = tmp;
        }
        cout << tb << " " << a / tb * b << endl;
    }
    return 0;
}

C++: #include<iostream>
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(cin>>a>>b){
    if(a<b) swap(a,b);
    int d=gcd(a,b);
    cout<<d<<" "<<a/d*b<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

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

int gcd(int a, int b) {
  if (a < b)
    return gcd_h(b, a);
  else
    return gcd_h(a, b);
}

int lcm(int a, int b) {
  int g = gcd(a, b);
  if (g) {
    return (a / g) * b;
  } else {
    return 0;
  }
}

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

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

template<class T> inline T gcd(T a, T b) {
    return (a == b) ? a : gcd(b % a, a);
}

template<class T> inline T lcm(T a, T b) {
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
#define U unsigned
#define L long
using namespace std;

U L gcd(U L L a,U L L b){
	if (a*b==0) return (a==0?b:a);
	else if (b%a==0) return a;
	else return gcd(b,a%b);
}

int main(){
	U L L x,y,g;
	while(cin>>x>>y){
		g=gcd(x,y); cout<<g<<" "<<(x/g)*y<<"\n";
	}
	return 0;
}

C++: #include <iostream>

#define ll long long

using namespace std;

ll gcd(ll x, ll y) {
 ll r;
 
 while(y != 0) {
  r = x % y;
  x = y;
  y = r;
 }

 return x;
}

ll lcm(ll x, ll y) {
 return x * y / gcd(x, y);
}

int main() {
 ll a, b;

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

 return 0;
}

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