Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include <cstdio>

using namespace std;

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

int main(){
    int a, b,gcd;
    long int lcm;
    while(true){
        scanf("%d%d",&a,&b);
        gcd = gcdr(a,b);
        //printf("%d\n",gcd);
        lcm = (long)gcd * a / gcd * b / gcd;
        printf("%d %ld\n",gcd,lcm);
    }
    
    return 0;
}

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

typedef long long int Long;

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

int lcm(Long t, Long ab) {
  return ab / t;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int x, int y)
{
	return y > 0 ? gcd(y, x % y) : x;
}

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

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

const long long zero = 0LL;
long long lcm, gcd;
long long GCD(long long,long long);

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

long long GCD(long long a,long long b){
	if( b==zero ) return a;
	return GCD( b , (a%b) );
}

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;
    }