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 <bits/stdc++.h>
using namespace std;

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

C++: #include <cstdio>

#define INT unsigned long

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

INT lcm(INT a, INT b)
{
  INT tmp = gcd(a, b);
  /* gcd(a, b) * lcm(a, b) = a * b */
  return tmp ? a * b / tmp : 0;
}

int main(void)
{
  INT a, b;
  
  while (std::scanf("%ld %ld\n", &a, &b) != EOF) {
    std::printf("%ld %ld\n", gcd(a, b), lcm(a, b));
  }

  return 0;
}

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

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

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 < num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i+1],num[i]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

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

	return 0;
}

C++: 
#include<iostream>
#include <xiosbase>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
long long kmm(long long a,long long b)
{
    return a*b/gcd(a,b);
}
int main()
{
	system("CLS");
    long long a,b;
    cin>>a>>b;
	while(!cin.eof())
	{
	cout<<gcd(a,b);
	cout<<" ";
	cout<<kmm(a,b);
	cout<<endl;
	cin>>a>>b;

	}
    return 0;
}

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

using namespace std;

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

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

int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %lld\n", gcd(a, b), lcm(a, b));
    }
}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  whie(scanf("%d%d",&a,&b) != EOF){
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);
  }

  return 0;
}

C++: #include<iostream>
#define max(a,b) a>b ? a : b
#define min(a,b) a<b ? a : b
using namespace std;

typedef long long ll;

ll LCM(ll a, ll b)
{
	ll result;
	ll n1 = max(a, b);
	ll n2 = min(a, b);
	for (int i = 1;; i++)
	{
		result = n1*i;
		if (result%n2 == 0)
			return result;
	}
}

ll GCD(ll a, ll b)
{
	while (true)
	{
		int ma = max(a, b), mi = min(a, b);
		if (ma%mi == 0)
			return mi;
		else
		{
			ma -= mi;
			return GCD(ma, mi);
		}
	}
}

int main()
{
	ll n1, n2;
	while (cin >> n1 >> n2)
		cout << GCD(n1, n2) << ' ' << LCM(n1, n2) << endl;
	return 0;
}

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

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

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

using namespace std;

long long a, b;

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(void) {
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

C++: #include <stdio.h>
int main(void){
    long long a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}

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

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

int main()
{   int a, b;
    int temp;
    while(true){
        if(!(cin >> a >> b))exit(0);
       
        if(a<b){
            temp = b;
            b = a;
            a = temp;
        }
        temp = gcd(a, b);
        cout << temp << " " << a/temp*b << endl;
    
    }    
    return 0;
}

C++: #include <stdio.h>

int main(){
long int a,b;
long int x,y,i,j;

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=b;i>0;i--){
if(a%i==0 && b%i==0){
x=i;
break;
}
}
}
else if(b>a){
for(i=a;i>0;i--){
if(a%i==0 && b%i==0){
x=i;
break;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=b*i;
break;
}
}
if(b*i==a*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

C++: /*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
  string xyz ="";
int x=0,y=0,z=0,w=0,i=0,j=0,n=0;
while(std::cin >> x>>y){
  z=x*y;
  w=x%y;
  while(w!=0){
    x=y;
    y=w;
    w=x%y;
  }
  std::cout <<y <<" "<<z/y<< '\n';
}

}

C++: #include <stdio.h>

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

int main(){
	int a,b;
	int t;
	while(scanf("%d%d", &a, &b) != EOF){
		t = gcd(a,b);
		printf("%d %d\n", t, a/t*b);
	}
}

C++: #include <iostream>
using namespace std;
int LCM(int a, int b);
int GCD(int a, int b, int ans1);

int main(){
    int a,b;
    while(cin >> a >> b){
        int ans1 = LCM(a,b);
        int ans2 = GCD(a,b,ans1);
        cout << ans1 << " " << ans2 << endl;
    }
}

int LCM(int a, int b){
    int r;
    if(a < b){
        int tmp = a;
        a = b;
        b = tmp;
    }
    while(1){
        r = a % b;
        if(r == 0) break;
        a = b;
        b = r;
    }
    
    return b;
}

int GCD(int a, int b, int ans1){
    int ans = b / ans1 * a;
    return ans;
}

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

template<class T>
T gcd(T a,T b){
	return b ? gcd(b,a % b) : a;
}

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

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