Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
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 (cin >> a >> b)
		cout << gcd(a, b) << " " << a * b / gcd(a, b) << endl;
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long

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

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

        return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
#define inff -30000000
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=2000+10;
ll gcd(ll a,ll b){
    return (!b)?a:gcd(b,a%b);
}
int main(){
    #ifdef SIYU
    freopen("in.txt","r",stdin);
    #endif // SIYU
    ll a,b;
    while(cin>>a>>b){
        ll ans=gcd(a,b);
        cout<<ans<<" "<<a/ans*b<<endl;
    }
    return 0;
}

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

int main(){
	int a, b, c, G, R, L, tmp, r;
	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 <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;
  }

  return 0;
}

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

int Func_gcd(int num1, int num2){
	int surplus;
	
	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
	int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = (num1*num2)/gcd;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

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

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)
{
	return a*b/gcd(a,b);
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

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

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		u_int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>
int gcd(int a,int b)
{
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    int a, b;
    while(scanf("%d%d", &a, &b) != EOF)
        printf("%d %d\n", gcd(a, b), a / gcd(a, b) * b);
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(i=0;i<=50;++i{
  cin>>a>>b;
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
}
  return 0;
}

C++: #include <iostream>

int main() {
	long long int a, b;
	while( std::cin >> a >> b ) {
		long long int m = ( a >= b ) ? a : b, n = ( a >= b ) ? b : a;
		while( n != 0 ) {
			long long int r = m % n;
			m=n; n=r;
		}
		std::cout << m << " ";
		long long int l = a * b / m;
		std::cout << l << std::endl;
	}
}

C++: #include<stdio.h>
int main(){
  long long int a,b,n,i,j;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>=b){
      n=b;
    }
    else{
      n=a;
    }
    i=a;
    j=b;

    while(1){
      /*   if(n<a){
	n=a%n;
      if(n==0){
	n=a;
	break;
      }
      }
      else if(n<b){
	n=b%n;
      if(n==0){
	n=b;
	break;
      }
      }*/

      n=a%b;
      if(n==0){
	n=b;
	break;
      }else{
	a=b;
	b=n;
      }

    }
    /*
    while(1){
      if(a*i==b*j){
	break;
      }
      else if(a*i<b*j){
	i++;
      }
     else if(a*i>b*j){
	j++;
	   }
	   }*/

    printf("%lld %.0f\n",n,(double)(i)*(double)(j)/(double)(n));
  }
  return (0);
}

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

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

int min(int a, int b){
    int d;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    d = a * b / max(a, b);
    
    return d;
}

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

C++: 
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b){
        int x=a,y=b;
        while(true){
            if(x==y)
                break;
            if(x>y)
                x-=y;
            else if(y>x)
                y-=x;
        }
        cout<<x<<" ";
        int keep=x;
        x=a/keep;
        y=b/keep;
        cout<<x*y*keep<<endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <cmath>
using namespace std;

int lcm(int max, int min) {
    int multiplier = 1;
    while ((max * multiplier) % min != 0) {
        multiplier++;
    }
    return max * multiplier;
}

int gcd(int max, int min) {
    int r = max % min;
    int x = min;
    while (r != 0) {
        int tmp = r;
        r = x % r;
        x = tmp;
    }
    return x;
}

int main(void) {
    int a, b;
    while (scanf("%d %d", &a, &b)+1)  {
        int min = (a < b)? a : b;
        int max = (a < b)? b : a;
        printf("%d %d\n", lcm(max, min), gcd(max, min));
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

long long calcGCD(long long a, long long b) {
	long long result = 0;

	while(result == 0) {
		if(a > b){
			a = a % b;
			if (a == 0) {
				result = b;
			}
		}
		else {
			b = b % a;
			if (b == 0) {
				result = a;
			}
		}
	} 
	return result;
}

int main() {
	long long a, b;

	while (cin >> a >> b) {

		long long gcd = calcGCD(a, b);
		long long lcm = a * b / gcd;

		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}