Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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.Printf("%d %d\n", y, lcm/y)
	}
}

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

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

int main(void){
    int n, m;
    while(cin >> n >> m){
        cout << gcd(n, m) << " " << lcm(n, m) << endl;
    }
}

int lcm(int a, int b){
    int sum_a = a;
    int sum_b = b;
    while(true){
        if(sum_a < sum_b){
            sum_a += a;
        } else if(sum_a > sum_b){
            sum_b += b;
        } else {
            return sum_a;
        }
    }
}

int gcd(int a, int b){
    int smaller = a < b ? a : b;
    int bigger = a > b ? a : b;
    int end_point = smaller / 2 + 1;
    int counter = 0;
    int answer = 0;
    while(counter <= end_point){
        counter++;
        if(a % counter == 0 && b % counter == 0){
            answer = counter;
        }
    }
    if(bigger % smaller == 0){                                    
        answer = smaller;                                         
    } 
    return answer;
}

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

LL GCD(LL a,LL b){ // a>=b とする
	if(a%b) return GCD(b,a%b);
	return b;
}

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

C++: #include <stdio.h>

int GetGCD(int x, int y);

int main(void){
    int n,m,gcd,lcm;
    
    while (scanf("%d %d", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%d %d\n", gcd, lcm);
    }
    return 0;
}

int GetGCD(int x, int y){
    return y%x ? GetGCD(y%x, x) : x;
}

C++: #include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<ll, int> ll_i;
struct edge { int u, v; ll w; };

ll gcd(ll a, ll b) {
	if (b == 0) return abs(a);
	else return gcd(b, a % b);
}

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

C++: #include <iostream>
#include<cstdio>
using namespace std;
long long a,b;
long long  gcd(long long m,long long n){
    if(m<n){
        long long p=n;
        m=n;
        n=p;
    }
    while(n!=0){
        long long  p=m%n;
        m=n;
        n=p;
    }
    return m;
}
long long  lcd(long long  m,long long  n){
    return m*(n/gcd(m,n));
}
int main()
{
    while(scanf(" %d %d",&a,&b)!=EOF){
        cout<<gcd(a,b)<<lcd(a,b);
    }
}

C++: #include <iostream>

using namespace std;

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

int main()
{

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

C++: #include<iostream>

#define     MAX_NUMBER         2000000000
#define     __ERROR_CODE__     (-1)

using namespace std;

int Integer_LCM(const unsigned int,const unsigned int);
int Integer_GCD(const unsigned int,const unsigned int);

int main(){
	int a,b;

	while(cin >> a >> b){
		cout << Integer_LCM(a,b) << " " << Integer_GCD(a,b) << endl;
	}

	return 0;
}

int Integer_LCM(const unsigned int a,const unsigned int b){
	int p,q,r;

	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	// 変数の初期化
	p = a;
	q = b;
	r = a % b;

	// ユークリッドの互除法
	while (r != 0){
		p = q;
		q = r;
		r = p % q;
	}

	return q;
}

int Integer_GCD(const unsigned int a,const unsigned int b){
	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	return ((a * b) / Integer_LCM(a,b));
}

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

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 < (int)num.size(); i+=2){
		u_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>
#include<string>
#include<algorithm>
using namespace std;


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(cin >> a >> b)
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
using namespace std;
long long m,n,gcd,lcm;
int main()
{
    while(cin>>m>>n)
    {
        if(m==1||n==1)
        {
            cout<<1<<" "<<m*n<<endl;
        }
        else
        {

        long long d=0,s=m;
       if(m>n)
       {
         s=n;
       }
       for(long long i=1;i<=s;i++)
       {
           if(m%i==0&&n%i==0)
           {
               d=max(d,i);
           }
       }
       cout<<d<<" "<<(m*n)/d<<endl;

        }
    }
}

C++: #include <fstream>
#include <iostream>
#include <string>
#include <cstring>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <ctime>
#include <assert.h>

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define eps 1e-8
#define M_PI 3.141592653589793

typedef long long ll;
const ll mod=1000000007;
const int inf=0x7fffffff;
ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
using namespace std;
ll gcd(ll a,ll b) {return b==0? a: gcd(b,a%b);}
int main()
{
    ll a,b;
    while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<endl;
    }
}

C++: #include<stdio.h>
int main(){
  unsigned long long a,b,m,ca,cb;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    ca = a;
    cb = b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    cb /= b;
    printf("%d %d\n",b,ca*cb);
  }
}

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

int yaku(int x, int y);
int bai(int n, int m);

int main(void){

	int n, m;
	while (cin >> n >> m){
	
		int gcd; //?????§??¬?´???°
		int lcm; //????°???¬?????°

		gcd = yaku(n, m);
		lcm = bai(n, m);

		cout << gcd << ' ' << lcm << endl;
	}
}

int yaku(int x, int y){

	if (x < y){
		int temp = x;
		x = y;
		y = temp;
	}

	while (y != 0){
		int temp = x % y;
		x = y;
		y = temp;
	}

	return x;
}

int bai(int n, int m){

	int x = n, y = m;

	while (x != y){
		if (x < y)
			x = x + n;
		else
			y = y + m;
	}

	return x;
}