Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <vector>
#include <math.h>

int main(void);
unsigned int gcd(unsigned int x, unsigned int y);
unsigned int lcm(unsigned int x, unsigned int y);

int main(){
	int dataset_count = 0;
	unsigned int first_num = 0;
	unsigned int second_num = 0;

	std::vector<unsigned int> first_num_vector;
	std::vector<unsigned int> second_num_vector;

	//while (dataset_count < 2){
		//std::cin >> first_num >> second_num;
	while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (unsigned int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
unsigned int gcd(unsigned int x, unsigned int y)
{
	unsigned int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
unsigned int lcm(unsigned int x, unsigned int y)
{
	unsigned int rtn;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	rtn = (x / gcd(x, y)) * (y / gcd(x, y));

	return rtn * gcd(x, y);
}

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

u_int getGCD(u_int m, u_int n){
  u_int temp;
  if(m < n)
    std::swap(m,n);
  while(n != 0){
    temp = m % n;
    m = n;
    n = temp;
  }
  return m;
}

inline u_int getLCM(u_int m, u_int n, u_int gcd){
  return m * (n / gcd);
}

int main(){
  u_int a, b, gcd;
  while(std::cin >> a >> b){
    gcd = getGCD(a, b);
    std::cout << gcd << " " << getLCM(a, b, gcd) << std::endl;
  }
  return 0;
}

C++: #include "iostream"
using namespace std;

int main()
{
	int a,b,k,GCD,LCM;   //GCD譛?、ァ蜈ャ郤ヲ謨ー  LCM譛?ー丞?蛟肴焚
	while(cin>>a>>b)
	{
		GCD=1;
		k=1;
		while(k<=a&&k<=b)
		{
			if(a%k==0&&b%k==0)
			{
				GCD=k;
			}
			k++;
		}
		LCM=(a/GCD)*b;
		cout<<GCD<<" "<<LCM<<endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

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

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

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

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



int main() {

	int a, b;
	while (cin >> a) {
		cin >> b;

		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
	
	return 0;

}

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

int gcd(int a, int b) {
  	int q,r;
	while(r!=0){
	q=b/a;
	r=b%a;
	b=a;
	a=r;
	}
	return b;
}

int main(void){
    int a, b;
    while(cin >> a >> b) {
      int lcm = a/gcd(a,b)*b;
      cout << gcd(a,b) << " " << lcm << 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;
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;
  cout<<g<<" "<<L<<endl;
  ++i;
}
  return 0;
}

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    int count = 0;
    while(std::cin >> a >> b && count < 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: //0005
#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b;

    while(cin>>a>>b){
        cout<<__gcd(a,b)<<" "<<a / __gcd(a,b) * b <<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}
int main(){
  while(true){
    int a,b;
    cin >>a>>b;
    if(cin.eof())return 0;
    int g = gcd(a,b);
    cout << g <<' '<<a/g*b<<endl;
  }
}

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

C++: #include <iostream>
using namespace std;
 
int gcd(int x, int y) {
    int amari;
    while(y != 0) {
        amari = x % y;
        x = y;
        y = amari;
    }
    return x;
}
 
int lcm(int x, int y) {
    int g = gcd(x, y);
    return x/g*y;
}

int main() {
    int a, b;
    while(true){
        cin >> a >> b;
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}