Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: 
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#define pi 3.14159265358979323846264338
using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m) {
		long long a = n, b = m,keep;
		while (a != b) {
			keep = min(a, b);
			b = max(a, b) - min(a, b);
			a = keep;
		}
		cout << a << " " << n/a*m << endl;
	}
	return 0;
}

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

long long int gcd(long long int a, long long int b) {
	if (a < b) { swap(a, b); } a = a % b;
	return (a == 0 ? b : gcd(a, b));
}

long long int lcm(long long int a, long long int b) {
	return a * b / gcd(a, 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 main()
{
	int a, b;
	double A, B;
	cin >> a >> b;
	double c = a;
	double d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	B = c*d / A;
	cout << A<<" "<<B<<endl;
	return 0;
}

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

int GCD(int a, int b)
{
	int max = 0, c = (a < b) ? b : a;
	for (int i = 1; i <= c; ++i) {
		if (a%i == 0 && b%i == 0)max = i;
	}
	return max;
}

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

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

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)


//----------------------------------
//----------------------------------

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

signed main()
{
    ios::sync_with_stdio(false);
	int64_t a, b;
	while(cin >> a)
	{
		cin >> b;
		int64_t gc = gcd(max(a,b),min(a,b));
		cout << gc << ' ' << a * b / gc << endl;
	}

}

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

int  gcd(int m, int n);
int lcm(int m,int n);

//?????§??¬?´???°??¨????°???¬?????°????±???????
int main()
{
	int a[50],b[50];
	int set = 0;
	while( cin >> a[set] >> b[set]){
		set++;
	}
	for(int i = 0;i < set; i++){
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	}

	return 0;
}

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

int lcm(int m,int n)
{
	if(0 == m || 0 == n)
		return 0;
	return ((m / gcd(m, n)) * n);
}

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

long long gcd(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a == b) ? a : gcd(b % a, a);
}

long long lcm(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
using namespace std;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

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

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

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair



int main(){
    typedef unsigned long long ull;
    ull a,b;
    while(cin>>a>>b){
        cout << __gcd(a,b) << " ";
        cout << a*b/__gcd(a,b) << endl;
    }
}

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

int main(void){
  long long 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++: #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 << endl;
		cout << (n * m) / sol << endl;
	}


	return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<int> num;
		int k = 0;
		long long max = 1;
		for(int i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(int i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	long a, b;
	while(cin >> a >> b) {
		long aa, bb, cc;
		aa = a; bb = b;
		while(bb) {
			cc = aa % bb;
			aa = bb;
			bb = cc;
		}
		cout << aa << ' ' << a*(b/aa) << endl;
	}
	return 0;
}

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

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a * b / y) << endl;
	}

}

C++: #include <iostream>

using namespace std;

int main () {
    while (!cin.eof()) {
        int num1;
        int num2;
        cin >> num1 >> num2;
        int a = num1, b = num2;
        if (a<b) {
            a = num2;
            b = num1;
        }
        int q = a/b, r = a%b;
        while (r != 0) {
            a = b;
            b = r;
            q = a/b;
            r = a%b;
        }
        a = num1/b;
        cout << b << " " << a*num2 << endl;
        
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int getGCD(int a, int b)
{
	if (a > b)
	{
		swap(a, b);
	}
	return (a == 0) ? b : getGCD(a, b % a);
}

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