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<stdio.h>

template <typename T>
T gcd(T a,T b) {
   if(b == 0) return a;
  return gcd(b,a%b); 
}
template <typename T>
T lcm(T a,T b) {
    return a/gcd(a,b)*b;
}


int main() {
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF) {
        printf("%d %d\n",gcd(a,b),lcm(a,b));
    }

    return 0;

}

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

int gcd(int a, int b){
    assert(a>=0 && b >=0);
    if(a < b){
        // return gcd(b,a);
        swap(a,b);
    }
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

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

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

C++: #include<iostream>
using namespace std;
long long gcd(unsigned long long a,unsigned long long b){
    if(!b)return a;
    return gcd(b,a%b);

}
int main(){
    unsigned long long n,m,c;
    while(cin>>n>>m){
        c = gcd(n,m);
        cout << c << " " << (n*m)/c << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm;
	while(1){
		if (scanf("%d%d",&a,&b)==EOF) break;
		gcd=a;
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=a*b/gcd;
		

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i-=2){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
}	
return 0;
	}

C++: 
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <complex>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;

#define REP(i,s,t) for(int i=(s);i<(t);i++)
#define FILL(x,v) memset(x,v,sizeof(x))

const int INF = (int)1E9;
#define MAXN 100005

string gcd_lcm(ll a, ll b)
{
	if(a > b)
	{
		ll A = a;
		ll B = b;
		ll c;
		while( b!=0)
		{
			c = b; 
			b = a % b;
			a = c;
		}
		stringstream s; 
		s << a;
		s << " ";
		s << A/a*B;
		s << "\n";
		return s.str();
	}
	else
	{
		return gcd_lcm(b, a);
	}
}

int main() 
{
	ll a, b;
	string out;
	while(cin >> a >> b)
	{
		out += gcd_lcm(a, b);
	}
	cout << out;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define mp1(a,b,c) P1(a,P(b,c))
#define pque(a) priority_queue<a>
#define rpque(a) priority_queue<a,vector<a>,greater<a>>

const int INF=1000000000;
const int dre_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dre_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const int kaijou[10]={1,1,2,6,24,120,720,5040,40320,362880};

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

int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b))printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
}

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

int main(){
    int a, b, lcm, gcm;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			_a = _a % _b;
			if(_b % _a == 0){
				gcm = _a;
				break;
			}
			std::swap(_a, _b);
		}
		lcm = a / gcm * b;
		std::cout << gcm << ' ' << lcm << std::endl;
	}
	return 0;
}

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 = 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 <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        if(cin.eof()){break;}
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

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

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

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
#define int long long
	int a, b, r, x, temp;
	while(cin >> a >> b){
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	}
	return 0;
}

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

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

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

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

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;
int main() {
	ll a, b;
	while(scanf("%lld %lld", &a, &b) != EOF) {
		if(a < b) swap(a, b);
		ll m = a, n = b;
		while(n) {
			ll t = m / n;
			swap(m -= t * n, n);
		}
		printf("%ld ", m);
		ll c = b / m;
		cout << a * c << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << a / y * b << endl;
	}
}