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 <iostream>

//最大公約数を求めるプログラム(m >= n)
int calcGcd(int m, int n);
//最小公倍数を求めるプログラム
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, x, y;
	
	while(std::cin >> x >> y){
		if(x > y) gcd = calcGcd(x, y);
		else gcd = calcGcd(y, x);
		lcm = calcLcm(x, y, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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



long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=2;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	if(i % j ==0){
		return j;
	}
	
	i %= j;
	int tmp;
	tmp = i;
	i = j;
	j = tmp;
	return gcd(i, j);
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>

using namespace std;

typedef unsigned long long ullong;

class cgl
{
public:
	ullong gcd(ullong, ullong);
	ullong lcm(ullong, ullong, ullong);
};

ullong cgl::gcd(ullong a, ullong b)
{
	if (a % b == 0)
		return b;
	return gcd(b, a % b);
}

ullong cgl::lcm(ullong a, ullong b, ullong g)
{
	return a * b / g;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cgl cg;
	ullong a, b, g;

	for (;;)
	{
		cin >> a >> b;
		if (cin.fail()) break;
		g = cg.gcd(a, b);
		cout << g << " " << cg.lcm(a, b, g) << endl;
	}

	return 0;
}

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

int main()
{
	long long int a, b;
	while (scanf("%lld %lld",&a,&b) != EOF) {
		if (a >= b)
			printf("%lld %lld\n",gcd(a, b),a*b/ gcd(a, b));
		else
			printf("%lld %lld\n", gcd(b, a), a*b / gcd(b, a));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

using namespace std;

int gcd(int a ,int b);
int lcm(int a,int b);

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

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

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

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

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

int main() {
	long long int a, b;
	while (cin>>a>>b) {
		cout << gcd(a, b) << ' ' << lcm(a, b)<<'\n';
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int GCD(int a, int b){
  return !b ? a : GCD(b, a%b);
}

int main(void){
  long long a,b,gcd,lcm;

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

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

C++: #include "stdio.h"

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

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = a-b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include <iostream>

using namespace std;
//辗转相除法求解a,b的最大公约数，使用前a、b请自行取绝对值
int gcd(long long a,long long b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

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

C++: #include<cstdio>
int a,b,t;int g(int a,int b){return b?g(b,a%b):a;}
main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",t=g(a,b),a/t*b);}

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

typedef long long ll;

ll GCD(ll a, ll b) {
    if(b == 0)
	return a;
    return GCD(b,a%b);
}


ll LCM(ll a, ll b) {
    
    ll G = GCD(a,b);

    return a/G * b/G * G;

}

int main() {

    ll a,b;

    while(cin >> a >> b) {

	cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }

    return 0;
}

C++: #include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
//#include <vector>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
int main(){
	int a, b;
	while (cin>>a>>b){
		int c = gcd(a, b);
		cout << c << " " << a / c*b << endl;
	}
	return 0;
}

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

int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

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

int gcd(int x,int y){
    if (y==0)return x;
    return gcd(MAX(x,y), MAX(x,y)%MIN(x,y));
}

int lcm(int x,int y){
    return x * y / gcd(x,y);
}

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

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

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

int main(){
    int a,b;
    while(cin>>a>>b){
        int gcd_=gcd(a,b);
        long long lcm=a/gcd(a,b)*b;
        cout<<gcd_<<" "<<lcm<<"\n";
    }
}

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

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

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
b = a;
a = tmp;

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