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 <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;

int main(){
//old
		/* 2014 ??????1
		int a[2],ans;
		cin >> a[0] >> a[1];
		ans = a[0] * a[1];
		cout << ans << endl;
		*/
		/* 2014 ??????2
		int a[6],ans = 0;
		cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
		if(a[0] + a[1] * 5 + a[2] * 10 + a[3] * 50 + a[4] * 100 + a[5] * 500 >= 1000) ans = 1;
		cout << ans << endl;
		*/
		/* 2014 ??????3
		int a,i = 0;
		cin >> a;
		int b[a],c[a],ans[a];
		while(a > i){
			cin >> b[i] >> c[i];
			ans[i] =  b[i] % c[i];
			if(ans[i] == 0) ans[i] = c[i];
			i++;
		}
		i = 0;
		while(a > i){
		cout << ans[i] << endl;
		i++;
		}
		*/
		/* 2014 ??????4
		int a[2],i = 1;
		cin >> a[0];
		int n[a[0]],m[a[0]];
		while (a[0] >= i){
			cin >> n[i] >> m[i];
			i++;
		}
		i = 1;
		cin >> a[1];
		int o[a[1]],p[a[1]];
		while (a[1] >= i){
			cin >> o[i] >> p[i];
			i++;
		}
		i = 1;
		int ii,c,aa;
		aa = a[0] + a[1];
		int ans[aa][2],hh[aa],mm[aa],chk,count = 1;
		while(aa >= i){
			ii = 1;
			chk = 1;
			if(a[0] >= i){
				while(i - 1 >= ii){
					if(n[i] == hh[ii] and m[i] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = n[i];
					mm[count] = m[i];
					count++;
				}
			}else{
				while(i - 1 >= ii){
					if(o[i - a[0]] == hh[ii] and p[i - a[0]] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = o[i - a[0]];
					mm[count] = p[i - a[0]];
					count++;
				}		

			}
			i++;
		}
		aa = count - 1;
		i = 1;
		while(aa >= i){
			ii = 1;
			c = 1;
				while(aa >= ii){
						if(hh[i] > hh[ii] or hh[i] == hh[ii] and mm[i] > mm[ii] and i != ii){
							c++;
						}
				ii++;
				}
			ans[c][0] = hh[i];
			ans[c][1] = mm[i];
		 i++;
		}
		i = 1;
		while(aa >= i){
			if(aa == i){
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << endl;;
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << endl;;
				}

			}else{
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << " ";
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << " ";
				}
			}
			i++;
		}
		//????????°???
		int n,i,ans = 100000,a,risi[2];
		cin >> n;
		for(i = 1;n >= i;i++){
			risi[0] =  ans * 0.05;
			risi[1] = risi[0];
			while(risi[1] >= 1000){risi[1] = risi[1] - 1000;}
				if(risi[1] > 0){risi[0] = risi[0] - risi[1] + 1000;}
			ans = ans + risi[0];
		}
		cout << ans << endl;
		*/
		/*int in,i[4];
		while(cin >> in){
		int ans = 0;
		for(i[0] = 0;9 >= i[0];i[0]++){
			//if(0 > in - i[0]) break;
			//cout << "[1]" <<  i[0] << endl;				
			for(i[1] = 0;9 >= i[1];i[1]++){
				//if(0 > in - ( i[0] + i[1] ) ) break;
				//cout << "[2]" << i[1] << endl;
				for(i[2] = 0;9 >= i[2];i[2]++){
					//if(0 > in - ( i[0] + i[1] + i[2] ) ) break;
					//cout << "[3]" << i[2] << endl;
					for(i[3] = 0;9 >= i[3];i[3]++){
						//if(0 > in - ( i[0] + i[1] + i[2] + i[3] ) ) break;
						//cout << "[4]" << i[3] << endl;
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						if(i[0] + i[1] + i[2] + i[3] == in){
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						ans++;
						}
					}	
				}
			}
		}
		cout << ans << endl;	
		}*/

		/*int in;
		cin >> in;
		int a[in];
		for(int i = 1;in >= i;i++){
			cout << "[IN] [" << i << "] ";
			cin >> a[i];
		}
		for(int i = 1;in >= i;i++){cout << "[OUT] ["<< i << "] " <<  a[i] << endl;}*/
//old;
		int a,b,GCD[2],OUTPUT[2],o[2];
		cin >> a >> b;
		GCD[0] = a;GCD[1] = b;
		o[0] = a / 1000000;
		while(GCD[0] != GCD[1]){
			if(GCD[0] > GCD[1]){
				GCD[0] = GCD[0] - GCD[1];
			}else if(GCD[1] > GCD[0]){
				GCD[1] = GCD[1] - GCD[0];
			}			
		}
		OUTPUT[0] = GCD[1];
		OUTPUT[1] = o[0] * b / OUTPUT[0];
		OUTPUT[1] = OUTPUT[1] * 1000000;
		cout << OUTPUT[0] << " " << OUTPUT[1] << endl;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n*m/a;
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: // -*- coding:utf-8; tab-width:4 -*-
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

// 解答
namespace solution {
    using namespace std;
   
    typedef istringstream ISS;
    typedef ostringstream OSS;
    typedef vector<string> VS;
    typedef long long LL;
    typedef int INT;
    typedef vector<INT> VI;
    typedef vector<VI> VVI;
    typedef pair<INT, INT> II;

    LL a, b;

    template <class T> T gcd( T a, T b ) {
        T i, j;
        for ( i = 0; ! ( a & 1 ); ++ i )
            a >>= 1;
        for ( j = 0; ! ( b & 1 ); ++ j )
            b >>= 1;
        while ( b != a ) {
            b -= a;
            if ( b < 0 ) {
                a += b;
                b = -b;
            }
            while ( ! ( b & 1 ) )
                b >>= 1;
        }
        return a << min( i, j );
    }

    template <class T> T lcm( T a, T b ) {
        T larger = a > b ? a : b;
        T smaller = a > b ? b : a;
        T res = larger;
        while ( res % smaller != 0 )
            res += larger;
        return res;
    }

    struct Solution {
        void init() {
        }
   
        bool input() {
            return cin >> a >> b;
        }

        void solve() {
            cout << gcd(a,b) << " " << lcm(a,b) << endl;
        }
      
        int run() {
            while ( init(), input() ) {
                solve();
            }
            return 0;
        }
    };
}

int main() {
    return solution::Solution().run();
}

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=a*b/g;
    cout << g << " " << l << endl;
  }

  return 0;
}

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

int gcd(int m, int n)
{
	// ?????°?????????????????´??????????????????
	if ((0 == m) || (0 == n))
		return 0;

	// ???????????????????????????
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm(int m,int n)
{
	// ?????°?????????????????´??????????????????
	if ((0 == m) || (0 == n))
		return 0;

	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

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