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>
#include <cmath>
#include <iomanip>

using namespace std;

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

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

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

    while (cin >> a >> b) {
        g = a > b ? gcd(a, b) : gcd(b, a);
        l = a > b ? lcm(a,b,g) : lcm(b,a,g);

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

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

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;

typedef long long llong;

int GCD(const llong& a, const llong& b) {
	llong g_a = a;
	llong g_b = b;
	if (a == 0 || b == 0)
		return 0;
	while (a != b)
	{
		if (a > b) 
			g_a -= g_b;
		else 
			g_b -= g_a;
	}
	return g_a;
}

int LCM(const llong& a, const llong& b) {
	llong l_a = a;
	llong l_b = b;
	if (a == 0 || b == 0)
		return 0;
	return ((l_a / GCD(l_a, l_b)) * l_b);
}

int main() {
	llong a, b;
	while (cin >> a >> b) {
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	}
	return 0;
}

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

int main(void){
  int x,y,g,l,t;
  while(cin >> x >> y){
    if(x<y)
      swap(x,y);
    g=__gcd(x,y);
    l=x*y/g;
    cout << g << " " << l <<endl;
  }
  return 0;
}

C++: 
/* vo00_05.cpp */
#include <iostream>
using namespace std;

int euclid(long long a, long long b);

int main()
{
	int c;
	long long a, b, d;

	while (true) {
		cin >> a >> b;
		if (cin.eof()) break;

		c = euclid(a, b);
		d = a * b / c;

		cout << c << ' ' << d << '\n';
	}

	return 0;
}

int euclid(long long a, long long b)
{
	if (a < b) { int temp = a; a = b; b = temp; }

	int r;
	while (b != 0) {

		r = a % b;
		a = b;
		b = r;

	}


	return a;
}

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

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

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main()
{   
    int a, b;
    int c;
    while (scanf("%d", &a) != EOF) {
        scanf("%d", &b);
        c = a * b;
        while (a != b) {
            if (a > b)
                a = a - b;
            else
                b = b - a;
        }
        printf("%d ", a);
        printf("%d\n", c / a);
    }
}

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

using namespace std;
//int solveGCD(int a, int b);

int a, b, tmp;

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

int main() {
  while(1) {
    scanf("%d %d", &a, &b);
    if(a<b) {tmp=a; a=b; b=tmp;}
    int gcd = solveGCD(a, b); 
    printf("%d %d\n", gcd, a/gcd*b);
  }
}

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

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


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

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

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        printf("%d %d\n",g,a);
    }
}

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

int gcd(int x,int y){
	int num;
	while(x % y != 0){
		num = x%y;
		x = y;
		y = num;
	}
	return y;
}


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

C++: #include <cstdio>
typedef long long int64;
int64 gcd(int64 a,int64 b)
{
	return b?gcd(a%b,b):a;
}
int main()
{
	int64 a, b;
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		int64 g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
}

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

long long int GCD(long long int a, long long int b) {
    return (b % a == 0) ? a : GCD(b % a, a);
}

long long int LCM(long long int a, long long int b) {
    return (a / GCD(a, b)) * b;
}

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

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 n;
	while(cin >> n){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		if (i==sizeof(a) / sizeof(a[0]) - 1){
			a[i] = n;
			// cout << "start" << endl;
			// cout << "a[0]=" << a[0] << "a[1]=" << a[1] << endl;
			cout << gcm(a[0],a[1]) << ' ' << lcm(a[0],a[1]) << endl;
			i = 0;
		}
		else {
			a[i] = n;
			i++ ;
		}
	}
	
	return 0;
}

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

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

int main(){
	int a, b;
	int i;
	int k;

	while(cin >> a >> b){

		if(a > b){
			i = GCD(a, b);
		}
		else{
			i = GCD(b, a);
		}

		a = a / i;
		b = b / i;

		k = a * b * i;

		cout << i << " " << k << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
typedef long long int LLI;
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
LLI gcd(LLI n,LLI m){
  while(m){
    n=n%m;
    swap(n,m);
  }
  return n;
}
int main(){
  LLI n,m;
  while(cin>>n>>m){
    LLI ans=gcd(n,m);
    cout<<ans<<" "<<ans*(n/ans)*(m/ans)<<endl;
  }
}

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

using namespace std;

typedef long long int llongi;

llongi GCD(const llongi& a, const llongi& b) {
	if (a%b == 0) {
		return b;
	}
	GCD(b, a%b);
}

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