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<iostream>
using namespace std;

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

int main(){
  int a,b;
  while(cin >> a >> b){
    int g = gcd(a,b);
    //lcm == a*b/gcd(a,b)で求まる
    //cout << g << " " << a*b/g << endl;  <-オーバーフローする
    cout << g << " " << a/g*b << endl; // <-オーバーフローしない
  }
}

C++: #include <iostream>

//calc G.C.D(m >= n)
int calcGcd(int m, int n);
//calc L.C.M
inline int calcLcm(int m, int n, int gcd);

int main(){
	int a, b;
	
	while(std::cin >> a >> b){
		int gcd, lcm;
		
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

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

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

int gcd(int a, int b)
{
     return(b ? gcd(b, a % b):a);
}

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

C++: #include <iostream>
using namespace std;
int main() {
    int a, b;
    while (cin >> a >> b) {
        long long ta = a, tb = b, tmp;
        while (ta != 0) {
            tmp = ta;
            ta = tb % ta;
            tb = tmp;
        }
        cout << tb << " " << a / tb * b << endl;
    }
    return 0;
}

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

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

int gcd(int a, int b) {
  if (a < b)
    return gcd_h(b, a);
  else
    return gcd_h(a, b);
}

int lcm(int a, int b) {
  int g = gcd(a, b);
  if (g) {
    return (a / g) * b;
  } else {
    return 0;
  }
}

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

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

template<class T> inline T gcd(T a, T b) {
    return (a == b) ? a : gcd(b % a, a);
}

template<class T> inline T lcm(T a, T b) {
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
#define U unsigned
#define L long
using namespace std;

U L gcd(U L L a,U L L b){
	if (a*b==0) return (a==0?b:a);
	else if (b%a==0) return a;
	else return gcd(b,a%b);
}

int main(){
	U L L x,y,g;
	while(cin>>x>>y){
		g=gcd(x,y); cout<<g<<" "<<(x/g)*y<<"\n";
	}
	return 0;
}

C++: #include <iostream>

#define ll long long

using namespace std;

ll gcd(ll x, ll y) {
 ll r;
 
 while(y != 0) {
  r = x % y;
  x = y;
  y = r;
 }

 return x;
}

ll lcm(ll x, ll y) {
 return x * y / gcd(x, y);
}

int main() {
 ll a, b;

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

 return 0;
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main() {
	int a, b,i;
	while (cin >> a >> b) {
		if (a < b) {
			for (i = a; i > 0; i--) {
				if (a%i == 0 && b%i == 0)
					break;
			}
		}
		else {
			for (i = b; i > 0; i--) {
				if (a%i == 0 && b%i == 0)
					break;
			}
		}
		cout << i << " ";
		if (a < b) {
			for (i = b; i <= 2000000000; i += b) {
				if (i%a==0)
					break;
			}
		}
		else {
			for (i = a; i <= 2000000000; i += a) {
				if (i%b==0)
					break;
			}
		}
		cout << i << endl;
	}
	return 0;
}

C++: #include <iostream>

//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±???????????????°??????
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

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

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 <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long a,b;
	long long tmp=1,tmp_1;

	
	while (cin >> a >> b)
	{

		for (long long i = 1; i <= a; i++)
		{
			if (a%i == 0 && b%i == 0 && tmp < i)
			{
				tmp = i;
			}
			
		}
		tmp_1 = a*b / tmp;

		cout << tmp <<" "<<tmp_1<<endl;
	}

	return 0;
}

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

int main() {
	double a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = fmod(a,b);
			}else b = fmod(b,a);
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b;
	while(cin>>a>>b)
	{
		ll ans=__gcd(a,b);
		cout<<ans<<" ";
		cout<<a/ans*b<<endl;;
	}
	return 0;
 }

C++: def gcd(a,b)
      return a if b == 0
      gcd(b,a%b)
end
def lcm(a,b)
      return a * b / gcd(a,b)
end
while line = gets
      a,b = line.split.map(&:to_i)
      p "#{gcd(a,b)} #{lcm(a,b)}"
end

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

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a <= b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}