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<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
typedef long long int LLI;
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
LLI gcd(LLI n,LLI m){
  while(m){
    n=n%m;
    swap(n,m);
  }
  return n;
}
int main(){
  LLI n,m;
  while(cin>>n>>m){
    LLI ans=gcd(n,m);
    cout<<ans<<" "<<ans*(n/ans)*(m/ans)<<endl;
  }
}

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

using namespace std;

typedef long long int llongi;

llongi GCD(const llongi& a, const llongi& b) {
	if (a%b == 0) {
		return b;
	}
	GCD(b, a%b);
}

int main() {
	llongi a, b;
	llongi gcd;
	while (cin >> a >> b) {
		a = max(a, b);
		b = min(a, b);
		gcd = GCD(a, b);
		cout << gcd << " " << a * b / gcd << endl;
	}
	return 0;
}

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

int gcd(int m,int n){
	if(b==0)
		return m;
	
	return gcd(n,m%n);
}

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {

	int a, b, c=1, GCD, LCM ,  d ,e;

	while (cin >> a >> b) {
		d = a;
		e = b;
		while (c) {
			c = a % b;
			if (c == 0) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = c;
			}
		}
		d /= GCD;
		e /= GCD;
		LCM = d * e * GCD;

		cout << GCD << " " << LCM << endl;
		c = 1;
	}

	return 0;

}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, K;
VL neg, pos;
VL nmax, pmax;

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

int main() {
    ll a, b;
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << a * b / gcd(a, b) << "\n";
    }
    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=1,m=1;
	if(a<b)swap(a,b);
	else 
	while(true){
		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 <algorithm>
#include <iostream>
using namespace std;

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

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

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

int main()
{
  int a,b;
  int g;
  long int l;
  while(cin >> a >> b){
  
    if(a>b) g=gcd(a,b);
    else if(a<b) g=gcd(b,a);
    else g=a;

    l=(long int)a*b/g;
    cout << g << " " << l << endl;
  }

  return 0;
}

C++: #include <cstdio>

int main(){
    long long int m, n, gcd, lcm, temp;
    while(scanf("%lld %lld", &m, &n) == 2){
        lcm = n * m;
        if( m < n ){
            temp = m;
            m = n;
            n = temp;
        }
       for(;;){
           if(n == 0) break;
           temp = n;
           n = m % n;
           m = temp;
       }
       gcd = m;
       lcm = lcm / gcd;
       printf("%lld %lld\n", gcd, lcm);
    }
    return 0;
}

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005

long int gcd(int a, int b) {
	if (a < 0) a *= -1;
	if (b < 0) b *= -1;
	if (a < b) {
		int t = a;
		a = b; 
		b = t;
	}
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(i>50){
cin>>a>>b;
if(a==0 || b==0){cout<<0<<" "<<0<<endl;}
x=a;y=b;
while(1){
  if(x<y){y-x;}
  else if(x>y){x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
if(a!=0 || b!=0){cout<<g<<" "<<L<<endl;}
  ++i;
}
  return 0;
}

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

template<typename T>
T gcd(T p, T q)
{
	while(q != 0)
	{
		T temp = p % q;
		p = q;
		q = temp;
	}

	return p;
}

template<typename T>
T lcm(T p, T q)
{
	return p / gcd(p, q) * q;
}

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int num[2];
inline int gcd(int a, int b)
{
	return num[0] = b == 0 ? a : gcd(b, a%b);
}
inline int* lcm(int a, int b)
{
	num[1] = a/gcd(a, b)*b;
	return num;
}
int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF)
	{
		if(a < b) swap(a, b);
		lcm(a, b);
		printf("%d %d\n", num[0], num[1]);
	}
	return 0;
}

C++: /*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */
#include <iostream>
#include <sstream>

#define N 2

using namespace	std;

long
gcd(long a, long b)
{
	return a % b == 0 ? b : gcd(b, a % b);
}
long
lcm(long a, long b)
{
	long t = gcd(a, b);
	return t ? (a * b) / t : 0;
}
int
main()
{
	string line;
	while (getline(cin, line)) {
		istringstream iss(line);
		long a, b;
		iss >> a >> b;
		cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){

long long int a,b,A,B;

while(cin>>a>>b){
 A=a;B=b;
 while (b)
      {
	int tmp = a % b;
	a = b;
	b = tmp;
      }

b=A*B/a;
cout<<a<<" "<<b<<endl;
}
return 0;
}