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

inline u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int a,b;
int main(){
	while(cin>>a>>b){
		for(int i=a+b;;i--){
			if(a%i==0&&b%i==0){
				cout<<i<<" ";
				goto loop;
			}
		}
		loop:;
		for(int i=1;;i++){
			if(i%a==0&&i%b==0){
				cout<<i<<endl;
				goto age;
			}
		}
		age:;
	}
	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>
using namespace std;

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int gcd = get_gcd(a,b);

        int lcm = (a * b) / gcd;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int euclid( int m, int n ) {
	if( n == 0 ) return m;
	return euclid( n, m % n );
}

int max( int a, int b ) {
	if( a > b ) return a;
	return b;
}

int min( int a, int b ) {
	if( a < b ) return a;
	return b;
}

int main(void){

	unsigned long long int a, b, GCD, LCM;

	while( true ) {
		if( cin.eof() ) break;
		cin >> a >> b;
		GCD = euclid( max( a, b ),min( a, b ) );
		LCM = ( a * b ) / GCD;
		cout << GCD << " " << LCM << 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 <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;
int main(void) {
	ull a, b;
	while(cin >> a >> b){
		if(a < b){
			ull tmp = a;
			a = b;
			b = tmp;
		}
		ull gcd = 1, lcm = a * b;
		for(int i = 2; i <= b; i++){
			while(a > 0 && b > 0 && a % i == 0 && b % i == 0){
				a /= i;
				b /= i;
				gcd *= i;
			}
		}
		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0) i = 0;
    else if (minimum == 1) i = 1;
    for(i == 2;i <= minimum; i++){
        if(a % i == 0 && b % i == 0) break;
        else if(i == minimum){
            i = 1;
            break;
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0) lcm = 0;
        else lcm = a1*a2/gcd;
        cout << gcd << " " << lcm << endl;
    }
}

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

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

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<3;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

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

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << gcd << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include <algorithm>
#include <sstream>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;

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

	return gcd(b, a % b);
}

int main()
{
	long long int a, b, x;
	while (cin >> a >> b && a != EOF) {
		x = gcd(a, b);
		cout << x << " " << a * b / x << endl;
	}
}

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

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a/gcd*b;

    printf("%ld %ld\n", gcd, lcm);
  }

  return 0;
}