Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

using namespace std;

typedef long long int llongi;

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

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

C++: #include <iostream>
#include <math.h>
using namespace std;
int main() {
	while (1) {
		int a, b, i, GCD, LCM;
		cin >> a >> b;
		for (i = 1; i <= a || i <= b; i++) {
			if (a % i == 0 && b % i == 0) {
				GCD = i;
			}
		}
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(1) << std::endl;	
  	}
	return 0;
}

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

ll p_cal_gcd(ll big, ll small)
{
    if(small == 0) return big;
    else return p_cal_gcd(small, big % small);
}

ll cal_gcd(ll a, ll b)
{
    return a > b ? p_cal_gcd(a, b) : p_cal_gcd(b, a);
}

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

C++: /*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

pair<vector<bool>, vector<int>> eratosthenes(int n){
    vector<int> res;
    vector<bool> is_prime(n + 1, true);
    for (int p = 2; p <= n; p++) {
        if (!is_prime[p]){
            continue;
        }
        for (int k = p * 2; k <= n; k += p){
            is_prime[k] = false;
        }
        res.push_back(p);
    }
    return make_pair(is_prime, res);
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

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

template<class T> inline T gcd(T a, T b) {
    assert(a > 0 && b > 0);
    return (a == b) ? a : gcd(b % a, a);
}

template<class T> inline T lcm(T a, T 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;
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>

using namespace std;

int main(){
    int a, b, r, g, l;
    while(cin >> a >> b){
        l = a*b;
        if(a < b) swap(a,b);
        do{
            r = a % b;
            a = b;
            b = r;
        }while(r);
        g = a; l /= g;
        cout << g <<' '<<l <<endl;
    }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	long int a,s,d,f,g,h,i,j;
	while(scanf("%ld %ld",&a,&s)!=EOF){
		g=0;
		g=a*s;
		if(a<s){
			d=a;
			a=s;
			s=d;
		}
		d=a%s;
		while(d!=0){
			a=s;
			s=d;
			d=a%s;
		}
		printf("%ld %ld\n",s,g/s);
	}
	return 0;
}

C++: //Õâ¸öcÐ´³öÀ´µÄ³ÌÐòÎªÉ¶Ö»ÄÜ¹ýÒ»°ëÄØ
#include<iostream>
#include<cstdio>
using namespace std;
long long gcd(long long m,long long n){
	return m==0?n:gcd(n%m,m);
}
int gcd(int a,int b){
	return a==0?b:gcd(b%a,a);
}
long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;            //Á½ÊýÏà³Ë³ýÒÔ×î´ó¹«±¶Êý 
}
int main()
{
	int a,b;
	while(~scanf("%d%d",&a,&b)){
		printf("%d ",gcd(a,b));
		printf("%lld\n",lcm(a,b));     //long longµÄÊä³ö¸ñÊ½·û£¬very important 
	}
	
	return 0;
 }

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

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t;
	float tmp, tmp2;
	while(cin >> a >> b){
		for(int i = (a > b)? b : a; i >= 1; i--){
			tmp = (float)a/i;
			tmp2 = (float)b/i;
			if(tmp == (int)tmp && tmp2 == (int)tmp2){
				cout << i << " ";
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				t += b;
			} else {
				s += a;
			}
		}
		cout << s << endl;
	}
	
	return 0;
}

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

int gcd(unsigned int a , unsigned int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

int lcm(unsigned int a , unsigned int b){
	int c;
	c=a/gcd(a,b);
	return c*b;
}

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

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

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

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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