Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include <iostream>
using namespace std;
int gcd(int a, int b){
    if(b==0) // 再帰の終了条件
        return a;

    return gcd(b, a%b);
}
int main(){
    while(true){
        int a, b;
        cin >> a >> b;
        if(cin.eof())
            break;
        int g = gcd(a, b);
        cout << g << ' ' << a/g*b << endl;
    }
    return 0;
}

C++: #include<iostream>

long int gcd(long int a, long int b){
  long int k;
  if(b>a){
    k=b;
    b=a;
    a=k;
  }
  k = a % b;
  if(k==0){
    return b;
  }
  while(k!=0){
    k = a % b;
    a = b;
    b = k;
  }
  return a;
}

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

  while(std::cin >> a >> b){
    k = (a*b)/gcd(a,b);
    std::cout << gcd(a,b) << " " << k << std::endl;
  }
}

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

using namespace std;

int main()
{
	unsigned int  a,b;

	while(cin >> a >> b){
		int temp = a<b?a:b;

		int t = temp;
		while((a<b?b:a)%t || (a<b?a:b)%t){
			if(!t)
				break;
			--t;
		}
		cout <<t<<" "<<flush;

		t = a>b?a:b;
		while(true){
			if(!(t%a))
				if(!(t%b))
					break;
			++t;
		}
		cout <<t<<endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b)
{
	if (b==0) return a;
	else if (a<b) return gcd(b, a);
	else return gcd(b, a%b);
}

int main()
{
	int a, b;
	
	while ( (cin >> a) && (cin >> b) ) {
		int g = gcd(a, b);
		int l = (a/g) * b;
		cout << g << " " << l << endl;
	}
	
	return 0;
}

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

int getGCD(int a, int b) { return b ? getGCD(b, a%b) : a; }
int main() {
	unsigned int a, b, gcd;
	while (cin >> a >> b) {
		gcd = getGCD(a, b);
		cout << gcd << " " << a*b/gcd << endl;
	}
	return 0;
}

C++: //--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.rbegin(),v.rend())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
ll a, b;

inline ll solve() {
	ll now = 2;
	ll ans = 1;
	while (now <= min(a, b)) {
		if (a%now == 0 && b%now == 0) {
			ans *= now;
			a /= now; b /= now;
		}
		else {
			now++;
		}
	}
	return ans;
}

inline ll solve2() {
	ll ans = max(a, b);
	for (ll i = max(a, b); i <= 2000000000; i+=max(a,b)) {
		if (i%a == 0 && i%b == 0) {
			ans = i;
			break;
		}
	}
	return ans;
}


int main() {
	while (cin >> a >> b) {
		cout << solve() << " " << solve2() << endl;
	}
	return 0;
}

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

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

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				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 < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

int solve_gcd(int a, int b)
{
	int m,n;
	if(a > b)
	{
		m = a;n = b;
	} else {
		m = b;n = a;
	}

	int r = m%n;
	while(r !=0)
	{
		m = n;
		n = r;
			
		r = m%n;
	}

	return(n);
}

int solve_lcm(int a, int b, int gcd)
{
	long long int c=(long long int)a*b;
	return(c/gcd);
}

int main()
{
	int a,b, gcd, lcm;

	while(cin >> a >> b)
	{
		gcd=solve_gcd(a,b);
		lcm=solve_lcm(a,b,gcd);
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

using namespace std;

int GCD(int m, int n);

int main()
{
	int m, n;
	
	while (cin >> m >> n){
		if (m < n)	swap(m, n);
		
		int gcd = GCD(m, n);
		int lcm = n * (m / gcd);
		
		cout << gcd << ' ' << lcm << endl;
	}	
	return (0);
}

int GCD(int m, int n)
{
	int r;
	while (m % n != 0){
		r = n;
		n = m % n;
		m = r;
    }
	return (n); 
}

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

int main(){
const int INF=1000000;
int a[2];
int GCD,LCM;
while(cin>>a[0]>>a[1]){
for(int i=0;i++;i<INF){
a[0]%=a[1];
if(a[0]==0){
GCD=a[1];
break;}
a[1]%=a[0];
if(a[1]==0){
GCD=a[0];
break;}}
LCM=a[0]*a[1]/GCD;
cout<<GCD<<" "<<LCM<<endl;}}

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

int Gcd(int a,int b){
    int c,d;
    if(b>a){
        d=a;
        a=b;
        b=d;
    }
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    int g=a;
    return(g);
}

int main(){
    int m,n;
    long p;
    int k;
    while(cin>>m>>n){
        p=m*n;
        k=Gcd(m,n);
        cout<<k<<" "<<p/k<<endl;
    }
}
}

C++: #include <cstdio>

int main()
{
    long a, b;
    long m, n, temp;

    while (scanf("%ld %ld", &a, &b) != EOF) {
        if (a < b) {
            temp = a;
            a = b;
            b = temp;
        }
        m = a;
        n = b;

        while (n != 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%ld %ld\n", m, a / m * b);
    }

    return 0;
}

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

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

unsigned long lcm(unsigned long a, unsigned long b)
{
	return a / gcd(a, b) * b;
}

int main()
{
	unsigned long a, b;
	while (std::cin >> a >> b) {
		std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}

	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <vector>
using namespace std;

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

int getLcm(int a, int b) {
  bool end = false;
  int multi = 1;
  while (!end) {
    if (a * multi % b == 0) {
      break;
    }
    multi++;
  }
  return a * multi;
}

int main(int argc, char const *argv[]) {
  int ans_gcd, ans_lcm, a, b, tmp;
  while (!(cin >> a >> b).eof()) {
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    ans_gcd = getGcd(a, b);
    ans_lcm = getLcm(a, b);
    std::cout << ans_gcd << " " << ans_lcm << '\n';
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

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

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