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>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

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

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

//================================================

int main() {
	LL A, B;

	while (cin >> A >> B) {
		cout << gcd(A, B) << " " << lcm(A, B) << "\n";
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	unsigned long long a, b;
	while (cin >> a >> b){
		unsigned long long gcd, lcm;
		unsigned long long c, d;
		c = max(a, b);
		d = min(a, b);
		while (true){
			if (c % d == 0) {
				break;
			}
			else{
				gcd = c%d;
				c = d;
				d = gcd;
			}
		}
		lcm = a*b / gcd;
		cout << gcd <<' '<< lcm << endl;
	}
}

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

int GCD(int a, int b)
{
    int asw = 1;
    int tmp;
    if (a > b) {
        while (b >= asw) {
            if (!(b % asw)) {
                tmp = b / asw;
                if (!(a % tmp))
                    break;
            }
            asw++;
        }
    } else {
        while (a >= asw) {
            if (!(a % asw)) {
                tmp = a / asw;
                if (!(b % tmp))
                    break;
            }
            asw++;
        }
    }
    return tmp;
}

int LCM(int a, int b)
{
    int asw;
    if (a < b) {
        asw = b;
        while (asw % a)
            asw += b;
    } else {
        asw = a;
        while (asw % b)
            asw += a;
    }
    return asw;
}

int main()
{
    int a, b;
    while ((cin >> a >> b)) {
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
}

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

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}
main()
{
    long long n,k,j,max,min,x,y,t;
    while(~scanf("%lld %lld",&x,&y))
    {
        max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
    printf("%lld %lld\n",min,max);
    }

}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

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

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}

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

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

 GCD(b, a%b);
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = Max(n,m);
    int b = n/a*m;
    cout << a << " " << b << endl;
  }
  return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		for(int i=min(a,b); i>=1; i--){
			if(!(a%i) && !(b%i)){
				gcd = i;
				break;
			}
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: include <iostream>
#include <vector>
using namespace std;
int main() {
 int a,b,c,x,y;
 vector<int> lc,gc;
 while(cin >> a >> b) {
 x=a; y=b;
 while( a % b!=0) { c=b; b=a % b; a=c; }
 lc.push_back(b); y=y/b; gc.push_back(y*x);
 }
 for (c=0;c<lc.size();c++) cout << lc[c] << " " << gc[c] << endl; 
 return 0;
}

C++: #include<stdio.h>

#define N 50

struct{int a,b;}d[N];

int main(){
    int i,j;
    int L;
    int a,b,large,saidai,saishou;

    for(i=0; i<N && scanf("%d %d",&d[i].a,&d[i].b)!=EOF; i++);
    L=i;

    for(i=0;i<L;i++){
        a=d[i].a; b=d[i].b;
        if(a>b)large=a;
        else large=b;
        for(j=1;j<=large;j++)
            if(a%j==0 && b%j==0)saidai=j;
        for(j=1;;j++)
            if(j%a==0 && j%b==0)
            {saishou=j; break;}
        printf("%d %d\n",saidai,saishou);
    }

    return 0;
}

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

inline u_long lcm(u_long a, u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b,r,G,R,L,tmp;
  while(cin >> a >> b){
    R = a; L = b;
    if(b > a){
      tmp = a; a = b; b = tmp;
    }
    while(1){
      r = a % b;
      if(r == 0)
        break;
      a = b;
      b = r;
       }
    G = b;
    R = R / G;
    L = L / G;
    cout << G <<" "<< R*L*G << endl;
  }
}

C++: #include<cstdio>
long int GCD(long int a,long int b){
	if(a < b){
		long int bf = a;
		a = b;
		b = bf;
	}
	while(b != 0){
		long int mod = a % b;
		a = b;
		b = mod;
		//printf("mod = %ld\n",mod);
	}
	return a;
}

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