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>

using namespace std;
int calcGcd(int a, int b){
    int d;
    if((a % b) == 0){
        return b;
    }else{
        d = calcGcd(b, a%b);
    }
    return d;
    
}

int main(){
    int a,b;

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

    return 0;
}

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// GCD show
		std::cout << b << std::endl;
		
		// LCM
		long int lcm = product / b;

		//LCM show
		std::cout << lcm << std::endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

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

int main()
{
	unsigned long a,b,g,l;

	while(scanf("%ld%ld",&a,&b)!=EOF){
		g=gcd(a,b);
		l=a/g*b;

		cout<<g<<" "<<l<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

lld gcd(lld x,lld y)
{
	if (y == 0)
	{
		return x;
	}
	return gcd(y,x%y);
}

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << " " << (n * m) / sol <<  endl;
	}


	return 0;
}

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

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

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

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

int main(){
	long long int a,b;
	while(cin>>a>>b){
		long long int c=a,d=b;
		while(c!=d){
			if(c>d){
				d+=b;
			}else{
				c+=a;
			}
		}
		while(1){
			d=a%b;
			if(d==0)break;
			a=b;
			b=d;
		}
		cout<<b<<' '<<c<<endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int GCD(long long M, long long N) {
	
    while(N != 0) { 
        long long r = M % N; 
        M = N; 
        N = r; 
    } 
    return M;
}

int LCM(long long m, long long n) {
    return m * n / GCD(m, n);
}

int main() { 
    long long m, n; 

    while( cin >> m >> n ) {

    cout << GCD(m, n) << " " << LCM(m, n) << "\n"; 
    
	}
    return 0; 
}

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

int main() {
  int p, q;
  int a, b, c;
  int lcm, gcd;

  while (1) {
    cin >> p >> q;
    if (cin.eof()) break;
    if (p > q) {
      a = p;
      b = q;
    } else {
      b = p;
      a = q;
    }

    while(a%b) {
      c = a%b;
      a = b;
      b = c;
    }
    lcm = b;
    gcd = p/lcm*q;
    cout << lcm << " " << gcd << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int yue(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int shang=max-min;
		while(shang!=min){
			if(shang<min){
				max=min;
				min=shang;
			}else{
				max=shang;
				min=min;
			}
			shang=max-min;
		}
		return shang;
	}
}
int bei(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int yu=max%min;
		int beishu=1;
		int mmax=max;
		while(yu!=0){
			beishu++;
			max=mmax*beishu;
			yu=max%min;
		}
		return max;
	}
}

long yue2(long a,long b){
	if(a==0||b==0){
		return 0;
	}else{
		long r=a%b;
		while(r!=0){
			a=b;
			b=r;
			r=a%b;
		}
		return b;
	}
}

int main(){
long a,b;
	while(scanf("%ld%ld",&a,&b)!=EOF){
		long y=yue2(a,b);
		printf("%ld %ld\n",y,bei(a,b));
	}
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

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

int lcmm(int a, int b) {
  return b / gcdd(a, b) * a;
}

signed main() {
	ll a, b;
  while(cin >> a >> b) {
    cout << gcdd(a, b) << " " << lcmm(a, b) << endl;
  }
	return 0;
}

C++: #include <iostream>

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << ac*bc/ b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << ac*bc / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << "1" << " " << a << endl;
		}
	}
	return 0;
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

unsigned long __gcd(unsigned long a, unsigned long b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

unsigned long gcd(unsigned long a, unsigned long b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

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

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << '\n';
    }
    
    return 0;
}

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

typedef long long lli;

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

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

int main() {
  lli a, b;

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