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<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

int GCD(long long int n,long long int m){
    if(n%m==0){
        return m;
    }
    return GCD(m,n%m);
}

int main(){
    while(1){
        if(scanf("%lld",&n)==-1)break;
        scanf("%lld",&m);
        if(n<=m){
            ans1=GCD(m,n);
        }
        else{
            ans1=GCD(n,m);
        }
        ans2=m*n/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

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

int main() {
	double a, b, c, d;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int gcd(int a,int b)
{
	if(b==0)
		return a;
	else 
		return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(cin>>a>>b)
	{
		long long i;
		if(a<b)
			swap(a,b);
		i=gcd(a,b);
		long long t=a*b/i;
		cout<<i<<" "<<t<<endl;
	}
	return 0;
}

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (i%a != 0 || i % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

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

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

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

int gcd(int a, int b) {
    int c=a%b;
    while(c) {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    while(cin>>a>>b) {
        int g=gcd(a, b);
        int l=a/g*b;
        cout<<g<<' '<<l<<'\n';
    }
    return 0;
}

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

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a>>b;
	
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << g << " " << l;

	
}

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

int setGcd(int a, int b) {
    int gcd;
    
    if(a == 0 || b == 0) return 0;
    
    while(a != b) {
        if(a > b) a -= b;
        else b -= a;
    }
    gcd = a;
    return gcd;
}

int setLcm(int a, int b) {
    int lcm;
    
    if(a == 0 || b == 0) return 0;
    lcm = a / setGcd(a,b) * b;
    
    return lcm;
}

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

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

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

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

int lcm(int a,int b){
	if(a<b){
		return lcm(a,b-a);
	}else if(a>b){
		return lcm(b,a-b);
	}else{
		return a;
	}
}

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

C++: #include<iostream>
#include<string>
#include <algorithm>
#include<iomanip>
#include<cmath>
using std::cin; using std::string;
using std::cout; using std::endl;
using std::sort;
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;
int main(){
    int n,m;
	int gcb,lcm;
	while(cin>>n>>m){
	for(int i=1;i<=n;i++){
		if(n%i==0 && m%i==0)
			gcb=i;
	}
	lcm=gcb*(n/gcb)*(m/gcb);
	cout<<gcb<<" "<<lcm<<endl;
		}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int t[2];
int ire(int a,int b){
	t[0]=b;t[1]=a;
}
main(){
	int n1,n2,a1,a2;
	while(cin>>n1>>n2){
		t[0]=max(n1,n2);
		t[1]=min(n1,n2);
		for(int i=0;;++i){
			t[0]=t[0]-t[1];
			if(t[0]==0){
				a1=t[1];
				break;
			}
			if(t[0]<t[1])ire(t[0],t[1]);
		}
		a2=(n1/a1)*n2;
		cout<<a1<<" "<<a2<<endl;
	}
}

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

int main(void)
{
    int a, b;
    while (cin >> a >> b) {
        int c, d;
        for (int i = a; 0 < i; --i) {
            if (a % i + b % i == 0) {
                c = i;
                break;
            }
        }
        for (int i = b; b < 2000000000; ++i) {
            if (i % a + i % b == 0) {
                d = i;
                break;
            }
        }
        cout << c << " " << d << endl;
    }
    return 0;
}

C++:     #include<cstdio>
    #include<iostream>
     
    using namespace std;
     
    int a, b;
    int gcd, lcm;
     
    void GCD(){
     
    	int big, small;
     
    	big = a;
    	small = b;
     
    	while (big) {
    		swap(big, small);
    		big = big % small;
    	}
    	gcd = small;
     
    }
     
    void LCM() {
    	lcm = a / gcd * b;
    }
     
     
     
     
    int main(){
    	while (cin >> a >> b) {
     
    		GCD();
    		LCM();
    		cout << gcd << " " << lcm << endl;
    	}
    	return 0;
    }

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define ll long long
using namespace std;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll int n, m;
  while(cin >> n >> m) {
    ll int gcd = __gcd(n, m);
    ll int lcm = n * m / gcd;
    cout << gcd << ' ' << lcm << endl;
  }
  return 0;
}

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


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(scanf("%d %d",&a,&b)!=EOF){
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}
}

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

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

C++: #include <stdio.h>


int main(void)
{
	unsigned int		 a,b,ax,bx, min, max, test_min[200], test_max[200];
	int			i,j=0;
	
	while(scanf("%d %d",&a, &b) != EOF){
		ax = a;
		bx = b;
		while(1){
			if(a > b){
				b = b+bx;
			}
			else if(b > a){
				a = a+ax;
			}
			else{
				break;
			}	
		}
		min = a;
		max = (ax*bx)/min;
		
		test_min[j] =min;
		test_max[j]=max;
		j++;
	}
	for(i=0;i<=j; i++){
		printf("%d %d\r\n", test_max[i], test_min[i]);
	}
	return 0;
}