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++: //Õâ¸ö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;
}

C++: //AA AE
#include <bits/stdc++.h>
using namespace std;
int data[2];
int answer;

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return(a);
}

int main(){
    while(cin>>data[0]>>data[1]){
        answer=gcd(data[0],data[1]);
        cout<<answer<<" "<<int(data[0]*data[1]/answer)<<endl;
    }
}

C++: #include <iostream>

using namespace std;

int main() {

	long long a, b;
	long long min, max;

	while (cin >> a >> b) {

		if (b > a) {
			long long dum = a;
			a = b;
			b = dum;
		}

		//cout << "a=" << a << "b=" << b << endl;
		
		//?????§??¬?´???°????±???????
		//???????????????????????????
		long long new_a = a, new_b = b;
		long long r;
		while (1) {
			r = new_a%new_b;
			if (r == 0) {
				max = new_b;
				break;
			}
			else {
				new_a = new_b;
				new_b = r;
				continue;
			}
		}

		//????°???¬?????°????±???????
		//2,000,000,000?????§?????????
		long long i=1, j=1;
		while (a*i<2000000000&&b*j<2000000000) {
			//cout << "ai=" << a*i << " bj=" << b*j << endl;
			if (a*i == b*j) {
				min = a*i;
				break;
			}
			else if (a*i < b*j) {
				i++;
			}
			else if (a*i > b*j) {
				j++;
			}
			
		}

		cout << max << " " << min << endl;
	}

	return 0;

}

C++: #include<stdio.h>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x<y)?x:y)

int prime[30000];	//素因数分解用に素数を求めておく.
int count;
int 素因数A[30000],素因数B[30000];	//素因数を入れる。

int GetPrime(int num);	//num以下の素数をprime[i]に保存
void DevPrime(int *p,int num);	//numを素因数分解。素因数prime[i]の数を*(p+i)に保存。
int GetLCM(int *pa,int *pb);
int GetGCD(int *pa,int *pb);

int pwd(int tei,int sisuu){
	int ans = 1;
	for(int i = 0;i < sisuu;i++)
		ans *= tei;
	return ans;
}

int main(){
	count = GetPrime(50000); 

	int a,b;
	int LCM[200],GCD[200],cor = 0;
	while(~scanf("%d%d",&a,&b)){
		DevPrime(素因数A,a);
		DevPrime(素因数B,b);
		LCM[cor] = GetLCM(素因数A,素因数B);
		GCD[cor] = GetGCD(素因数A,素因数B);
		cor++;
	}
	for(int i = 0;i < cor;i++)
		printf("%d %d\n",GCD[i],LCM[i]);
	return 0;
}

int GetPrime(int num){
	int count = 0,i,j;
	for(i = 2;i <= num;i++){
		for(j = 0;j < count;j++){
			if(i%prime[j] == 0)                                                                                                                                                                                                                                               
				break;
		}
		if(j < count)
			continue;
		prime[count] = i;
		count++;
	}
	return count;
}
void DevPrime(int *p,int num){
	int i;
	for(i = 0;i < count;i++){
		//保存したい配列を初期化
		p[i] = 0;
		//割りきれなくなるまでその素数で割る。
		while(num%prime[i]==0){
			num /= prime[i];
			p[i]++;
		}
	}
}
int GetLCM(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MAX(pa[i],pb[i]));
	}
	return ans;
}
int GetGCD(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MIN(pa[i],pb[i]));
	}
	return ans;
}

C++: #include <iostream>
using namespace std;
 
int gcd(int x, int y) {
    int amari;
    while(y != 0) {
        amari = x % y;
        x = y;
        y = amari;
    }
    return x;
}
 
int lcm(int x, int y) {
    int g = gcd(x, y);
    return x/g*y;
}

int main() {
    int a, b;
    while(true){
        cin >> a >> b;
        if (std::cin.eof()) {
            break;
        }
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}

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

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

int main(){
    int a,b;
    while(cin>>a>>b){
        int gcd_=gcd(a,b);
        cout<<gcd_<<" "<<a*b/gcd_<<"\n";
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  ll a,b;
  while(scanf("%lld %lld",&a,&b) != -1){
    cout << __gcd(a,b) << " " << (a*b/__gcd(a,b)) << endl;
  }
  return 0;
}

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

using namespace std;

long long kpk(long long n, long long m){
	long long a,b;
	a=n;
	b=m;
	while(a!=b&&b!=a){
		while(a<b){
			a+=n;
		}
		while(b<a){
			b+=m;
		}
	}
	return b;
}

long long fpb(long long n, long long m){	
	int r;
	if (n<m){
		swap(n,m);
	}
	r=n%m;
	while(r>0){
		n=m;
		m=r;
		r=m%m;
	}
	return m;
	}
	
int main(){
	long long a,b;
	while(cin>>a>>b){
		cout<<fpb(a,b)<<' '<<kpk(a,b)<<endl;
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 1;
	while (cin >> a, cin >> b)
	{
		int w = a;
		int x = b;
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i * c;
				a = a / i;
				b = b / i;
				i = 1;
			}
		}
		cout << c <<" "<< w * x / c << endl;
	}
	return 0;
}