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 <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<V<T>>;
#define fi first
#define se second
#define maxs(x,y) (x=max(x,y))
#define mins(x,y) (x=min(x,y))
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1e9+7;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  while(cin >> a >> b){
    int g = __gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
}

C++: #include<cstdio>
int gcd(int a, int b){
  if(a == 0){
    return b;
  }else if(a > b){
    return gcd(a%b, b);
  }else if(a < b){
    return gcd(b%a, a);
  }
}
int main(){
  int a, b;
  while(~scanf("%d%d", &a, &b)){
    //scanf("%d%d", a, b);
    int c=gcd(a,b);
    printf("%d %ld\n", c, ((long)a*(long)b)/c);
  }
}

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

int euclid_alg(const int a, const int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

using namespace std;

long long get_gcd(long long m, long long n) {
    /* Euclidean Algorithm */
    while (n)
        swap(m%=n, n);

    return m;
}

int main() {
    while (true) {
        long long a, b;
        if (scanf("%lld %lld", &a, &b) == EOF)
            break;

        long long gcd=get_gcd(a, b);
        printf("%lld %lld\n", gcd, a*b/gcd);
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl;
  return 0;
}

C++: #include<iostream>

using namespace std;

//Euclidean algorithm
int gcd(long m, long n)
{
	long t;
	while (m != 0) {
		t = m, m = n % m, n = t;
	}
	return n;
}

//gcd(a, b) * lcm(a, b) = a * b
int lcm(long n, long m) {
	return n * m / gcd(n, m); 
}



int main(){
	long n, m;
	
	while(cin >> n >> m) {
		cout << gcd(n, m) << " " << lcm(n, m);
	}

	return 0;
}

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

unsigned GCD(unsigned a, unsigned b)
{
	unsigned small = (a<b)?a:b;
	unsigned gcd=1;
	for(unsigned i=2; i<=small; ++i)
	{
		if(a%i==0 && b%i==0)
		{
			gcd = i;
		}
	}
	return gcd;
}

unsigned LCM(unsigned a, unsigned b)
{
	unsigned large = (a<b)?b:a;
	for(unsigned i=large; i<2000000000; ++i)
	{
		if(i%a==0 && i%b==0)
		{
			return i;
		}
	}
}

int main()
{
	double a,b;
	while(cin>>a>>b)
	{
		cout << GCD(a,b) << ' ' << LCM(a,b) << '\n';
	}
}

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << lcm << std::endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

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

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

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

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

int main() {
	
	int a,b,M,m,g;
	
	while(cin>>a>>b){
		if(a>b){M=a;m=b;} else{M=b;m=a;}
		for(int i=1;i<=M;i++){
			if(M%i==0&&m%(M/i)==0){g=M/i;break;}
			}
		cout<<g<<" "<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

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

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
 return 0;
}

C++: /* -*- coding:utf-8 -*- */

#include <iostream>

using namespace std;

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

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

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