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>
using namespace std;


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){
long a,b,r;
while(scanf("%ld %ld",&a,&b) != EOF){
	
	long c=a*b;
			
	if(b>a){r=a; a=b; b=r;}

	LOOP(i,a%b!=0){
	r=a%b;
	a=b; b=r;		
	}
	printf("%ld %ld\n",a%b,c/(a%b));
}
return 0;		
}

C++: #include <iostream>

#define CASE long int

using namespace std;

CASE GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

int main(){
	CASE a, b;
	while (1)
	{
		cin >> a;
		cin >> b;
		cout << GCD(a, b) << " " << a * b / GCD(a, b) << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

ll getLCM(ll a, ll b){
	if (a < b) { swap(a, b); }
	while (a % b) {
		a = a % b;
		swap(a, b);
	}
	return b;
}

int main(){
	ll a, b, A, B;
	ll gcd, lcm;
	for (; cin >> a >> b; cout << lcm << " " << gcd << endl) {
		lcm = getLCM(a, b);
		gcd = a * b / lcm;
	}
	return 0;
}

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

//最大公約数
int gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
int lcm(int a, int b)
{
    return (a * b / gcd(a,b));
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or a>2000000000 or b <= 0 or b > 2000000000){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << " "<< lcm(a,b)<< "\n";
    }
}

return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i,x,y;
while(cin>>a>>b){
int max=0,min;
i=1;
x=a;
y=b;
while(i!=0){
i=x%y;
x=y;
y=i;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long a,b,yakuans,baians;
	while(cin>>a>>b){
		if(a>b)swap(a,b);
		for(int i=2;i<=a;i++){
			if((a/i)*i==a){
				if((b/i)*i==b){
					yakuans=i;
				}
			}
		}
		baians=(a*b)/yakuans;
		cout<<yakuans<<" "<<baians<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int a, b;

  function<int(int, int)> gcd = [&](int a, int b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
  };
  function<int(int, int)> lcm = [&](int a, int b) {
    return a / gcd(a, b) * b;
  };

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

C++: #include <iostream>
#include<stdio.h>
#define MAX_N 100005
#include<string>
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
    if(b == 0){return a;}
    else{
        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;
    }


}

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

C++: #include <iostream>
using namespace std;
int gcd(int a, int b) {
	if (a%b) {
		return gcd(b,a%b);
	}else {
		return b;
	}
}
int main() {
	int a = 0;
	int b = 0;
	int max = 0;
	int d = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
		}
		else {
			max = a;
		}
		d = gcd(a, b);
		a = a / d * b;
		cout << d << ' ' << a << "\n";
	}
	return 0;
}