Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include<cstdio>
#include<iostream>
using namespace std;
#define ull unsigned long long
ull a, b, ans;

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

ull lcm(ull a, ull b, ull GCD){
	a = a / GCD;
	b = b / GCD;
	return a * b * GCD;
}


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

C++: #include <iostream>

using namespace std;

int main() {
    long long a, b, r, mul;
    while (cin >> a >> b) {
        mul = a * b;
        while ((r = a % b) != 0) {
            a = b;
            b = r;
        }
        cout << b << " " << mul / b << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (long j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


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

int main()
{
	int a, b;
	while (~scanf("%d%d", &a, &b))
		printf("%d %d\n", gcd(a, b), lcm(a, b));
}

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

int main () {
    int a, b, c, d, e, f, g, l;
    cin >> a >> b;
    c = e = a; d = f = b;
    while(1) {
        if(a>b) {
            a %= b;
            if(b==0) {g =b; break;}
        }
        else if(a<b) {
            b %= a;
            if(a==0) {g= a; break;}
        }
    }
    while(1) {
        if(c>d) d += f;
        else if(c<d) c += e;
        if(c == d) l = c;
    }
    cout << g << " " << l << endl;
}

C++: #include <iostream>
#define ll long long
using namespace std;
ll gcd(ll a,ll b)
{
	return b==0 ? a :gcd(b,a%b);
}
int main()
{
	ll x, y;
	while(~scanf("%I64d%I64d",&x,&y))
	{
		ll ans=gcd(x,y);
		printf("%I64d %I64d\n",ans,x/ans*y);
	}
}

C++: #include<iostream>
using namespace std;
int euclid(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return euclid(b,a%b);
}

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

C++: #include <iostream>
#include <sstream>
//#include <fstream>

using namespace std;

int gcd (int a, int b)
{
	if (a > b ){
		swap (a, b );
	} // end if
	while (b % a != 0 ){
		b = b % a;
		if (a > b ){
			swap (a, b );
		} // end if
	} // end while

	return a;
}

int lcm (int a, int b )
{
	int res = a / gcd (a, b );
 	res *= b;

	return res;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.gl", "r", stdin);
	string str = "";

	while (getline (cin, str ) ) {
		int a, b;
		stringstream ss (str );
		ss >> a >> b;
		cout << gcd (a, b ) << ' ' << lcm (a, b ) << endl;
	} // end for

	return 0;
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

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

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>

int  main() {

//?????§??¬?´???° =????????????????????????????????????
/*(1) a ??? b ??§???????????????????????? r ?????\????????????
???(2) r ??? 0 ?????? b ????????§??¬?´???°??§?????????????????????????????????
???(3) ????????§????????¨????????°a = b?????°b = r ??¨?????? (1) ???????????????????????????*/

//????°???¬?????° =???a*b???/???a??¨b????????§??¬?´???°?????§?±?????????????
	int a = 0, b = 0, swap, kp,num = 1,osu;
	std::cin >> a >> b;
	if (b >= a) { swap = a; a = b; b = swap; }


	while (num) {
		kp = a%b;
		if (kp == 0) { std::cout << b; num = 0; osu = a*b / kp;
		std::cout << " " << osu << std::endl;
		}
		else { a = b; b = kp; }
	}

	
}

C++: #include<iostream>
using namespace std;
int a=0;
int b=0;
long int c=0;
int n,m;
void koyaku(int i , int j)
{
  if(i == j)return ;
  if(i < j)
    {
      int x = i;
      i = j;
      j = x;
    }

  a = i - j;

  while(1)
    {
      b = j - a;
      
      if(a == b)return ;
    }
}

void kobai(int i , int j)
{
  if(i == j)return ;

  c = i * j / a;
}

int main()
{
  while(scanf("%d %d",&n,&m) != EOF)
    {
      koyaku(n,m);
      kobai(n,m);
      cout << a << " " << c << endl;
    }
}

C++: #include<stdio.h>
#include<string.h>

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  return x * y / GCD(x,y);
}



int main(void)
{
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	int k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

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

void solve()
{
	unsigned long long int a;
	while(cin >> a)
	{
		unsigned long long int b;
		cin >> b;
		if(a < b)
		{
			unsigned long long int temp = a;
			a = b;
			b = temp;
		}
		unsigned long long int g = gcd(a, b);
		unsigned long long int lcm = a * b / g;
		cout << g << " " << lcm << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int gcd(int m, int n) {
    if (m == 0 || n == 0) {
        return 0;
    }
    while (m != n) {
        if (m > n) {
            m = m - n;
        } else {
            n = n - m;
        }
    }
    return m;
}

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