Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(int, int);

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		int tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

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

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

C++: #include<iostream>

using namespace std;

int a, b;
int change;
int GCD(int m, int n)
{
	if((0==m)||(0==n))
	{
		return 0;
	}
	while(m!=n)
	{
		if(m>n)
		{
			m=m-n;
		}
		else
		{
			n=n-m;
		}
	}
	return m;
}
int LCM(int m,int n)
{
	if((0==m)||(0==n))
	{
		return 0;
	}
	return m/GCD(m,n)*n;
}
int main()
{
	while(cin>>a>>b)
	{
		printf("%d %d\n",GCD(a,b),LCM(a,b));
	}
}

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    cin >> x >> y;

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

    cout <<  gcd <<" "<< lcm << endl;

    return 0;
}

C++: #include<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

int GCD(long long int n,long long int m){
    if(n%m==0){
        return m;
    }
    return GCD(m,n%m);
}

int main(){
    scanf("%lld%lld",&n,&m);
    if(n<=m){
        ans1=GCD(m,n);
    }
    else{
        ans1=GCD(n,m);
    }
    ans2=m*n/ans1;
    printf("%lld %lld\n",ans1,ans2);
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


V<string> split(const string& s, char c) {
  V<string> res;
  stringstream ss(s);
  string t;
  while (getline(ss, t, c)) res.push_back(t);
  return res;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  string s;
  while (getline(cin, s)) {
    auto ss = split(s, ' ');
    lint a = stoll(ss[0]), b = stoll(ss[1]);
    lint g = __gcd(a, b);
    lint l = a * b / g;
    cout << g << ' ' << l << '\n';
  }
}

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

int main(){
    long long int a,b,r=1;
    while(cin>>a>>b){
    if(a<b){
        long long int temp;
        temp=b;
        b=a;
        a=temp;
    }
    long long int tempa=a,tempb=b;
    r=b;
    b=a;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;

    }
    long long ans=tempa*tempb/b;
    cout<<b<<" "<<ans<<endl;
    return 0;
}
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;

		a = 0, b = 0;
	}

	//getchar();

	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;
int main(){
	while(1){
		long long a,b;
		cin>>a>>b;
		long long c=a*b;
		long temp;
		if(a<b){temp=a;a=b;b=temp;}
		if(cin.eof()) {break;}
		long q,r;
		while(a%b!=0){
			q=(long long)a/b;		
			r=(long long)a%b;
			a=b;
			b=r;
		}
		cout<<b<<" "<<c/b<<endl;		
	}
	return 0;	
}

C++: #include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
int main(){
	int a,b;
	while(cin>>a>>b) printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
	return 0;
}

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

int main() {
	int a,b,c;
	while(cin>>a>>b){
		int g=0,l=0;
		if(a<b){
			c=b;
			b=a;
			a=c;
		}
		while(1){
			int i=1;
			if((i*a)%b==0){
				g=i*a;
			}
			if(g==i*a) break;
			i=i+1;
		}
		while(1){
			int i=2;
			if(a%i==0){
				if(b%(a/i)==0){
					l=a/i;
				}
			}
			i=i+1;
			if(l!=0) break;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main(){
  int m,n;
  while(cin>>m>>n){
    cout << gcd(m,n) << ' ' << lcm(m,n) << endl;
  }
}

C++: #include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>
#include <cstring>

#define dprintf(s,...) printf("%s:%d" s,__func__,__LINE__,__VA_ARGS__)
using namespace std;

typedef pair<int,int> P;

const int N=10000;
long long int a,b;


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

int main(){


  while(1){

    cin>>a>>b;
    if(cin.eof()) break;

    long long int c,d;
    c=gcd(a,b);
    d=a*b/c;
    cout<<c<<" "<<d<<endl;
    
  }

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define MOD 1000000007 //10^9+7
#define INF 1000000000 //10^9

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


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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){int a,b;while(cin>>a>>b)cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0;}

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

int gcd(unsigned long int m,unsigned long int n) {
	if (n == 0)return m;
	while (m%n != 0) {
		m = m%n;
		swap(m, n);
	}
	return n;
}

int main() {
	unsigned long int a, b; vector<unsigned long int> GCDS; vector<unsigned long int> LCMS;
	while(cin>>a>>b) {
		GCDS.push_back(gcd(a, b));
		LCMS.push_back(a / gcd(a, b)*b);
	}
	for (int i = 0; i < GCDS.size(); i++) {
		cout << GCDS[i] << ' ' << LCMS[i] << endl;
	}
}