Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T>
map<T, ll> get_zaatu(vector<T> vals) {
  sort(all(vals));
  vals.erase(unique(all(vals)), vals.end());
  map<T, ll> res;
  rep(i, vals.size()) res[vals[i]] = i;
  return res;
}
template<typename T>
void zaatu(vector<T>& vals) {
  map<T, ll> z = get_zaatu(vals);
  each(x, vals) x = z[x];
}
// template<typename T1, T2>
// void zaatu(vector<T1>& vals, const function<T2(T1)>& f) {
//   vector<T&> v;
//   each(x, vals) v.pb(f(x));
//   zaatu(v);
// }


int main() {
  ll 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 p,q,r;

if(a<b){p=b;b=a;a=p;

}

    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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

C++: 
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
	long long ta=a,tb=b;
	long long s=0,m=0;
	if(a<b)swap(a,b);
	
	while(true){
		long long  tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

C++: #include <iostream>

int main()
{
    int a, b;
    while (std::cin >> a >> b) {
        if (b > a) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int m = a;
        int n = b;

        while (n != 0) {
            int tmp = n;
            n = m % n;
            m = tmp;
        }
        std::cout << m << " "<< (a * b / m) << std::endl;
    }

    return 0;
}

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

int gcd(int x,int y){
    int a,b;
    a=x;
    b=y;
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
    int x,y;
    while(cin>>x>>y){
        int c=gcd(x,y);
        int lcm=(x*y)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,gcd=0,lcm=0,min=0,count=0;
    while(cin>>a>>b){
        count++;
        if(count>50)break;
    if(b>a)min=a;
    else min=b;
    
    for(long int k=min;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    
   gcd=a*b/lcm;
    
    cout<<lcm<<" "<<gcd<<endl;
    
}
}

C++: #include <iostream>
#include <algorithm>
#define MAX_N 1001
using namespace std;
typedef long long ll;
//lcs
int n,m;
string s,t;
int dp[MAX_N+1][MAX_N+1];
void solve(){
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++){
      if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
      else dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
    }
  cout<<dp[n][m]<<endl;
}
//lcm
ll lcm(int gcdv,int a,int b){
  return (ll)a*b/gcdv;
}
//greatest common divisor
int main() {
  int a,b;
  while(cin>>a>>b){
    int r=__gcd(a,b);
    cout<<r<<' '<<lcm(r,a,b)<<endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<cmath>

long long gcd(long long a, long long b)
{
    return b?gcd(b,a%b):a;
}
long long m,n;
int main()
{
    while(~scanf("%lld%lld",&m,&n))
    {
        long long temp = gcd(m,n);
        printf("%lld %lld\n",temp,m/temp*n);
    }
    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <limits>
using namespace std;

int main() {
	int x;
	int y;
	int g;
	while (scanf("%d %d", &x, &y)!=EOF) {
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

C++: #include<stdio.h>

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

int main(){
  long long int a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d\n",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

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

typedef long long ll;
using namespace std;

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

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

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

long long gcd(long long m,long long n){
	if(m==0||n==0) return 0;
	while(m!=n){
		if(m>n) m=m-n;
		else n=n-m;
	}
	return m;
}

int main(void){
	long long a,b;

	while(cin >> a >>b){
		cout << gcd(a,b) << " " << a/gcd(a,b)*b << 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\n",a,x/a*y);
}	
return 0;
	}

C++: #include<iostream>
#include<list>
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) > (b) ? (b) : (a))
using namespace std;


int main(){
	long a,b,r,x,y;
	list<long> aby;
	
	while(!(cin>>a>>b).eof()){
		x=a,y=b;
		while(1){
			r=MAX(x,y)%MIN(x,y);
			if(r==0) break;
			x=MIN(x,y);
			y=r; 
		}
		aby.push_back(a);
		aby.push_back(b);
		aby.push_back(MIN(a,b));
		
	}
	list<long>::iterator it = aby.begin();
	while(it != aby.end()){
		a = *it, it++;
		b = *it, it++;
		y = *it;
		cout << y << " "<<(a*b)/y <<endl;
		it++;
	}
	
	return 0;
}

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

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

int lcm(int m,int n)
{
    return ((m*n)/gcd(m,n));
}

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

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

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