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


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


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


int main()
{
    while( 1 ){
        long long int a, b;
        if( scanf("%lld%lld", &a, &b) == EOF ) break;
        printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    }

    return 0;
}

C++: #include<iostream>

void swap(int&, int&);
int gcd(int, int);

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

	return 0;
}

void swap(int& a, int& b)
{
	int tmp = a;
	a = b;
	b = tmp;

	return;
}

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
long long MOD; template<class T> void mod(T &n){MOD=n;}
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll


signed main(){
  int a,b;
  while(cin>>a>>b&&a&&b){
    cout<<gcd(a, b)<<" "<<lcm(a, b)<<en;
  }
}

C++: #include<iostream>
using namespace std;
int main()
{
    long a,b,t,m,n,l;
    while(cin >> a >> b)
     {
        if(a>=b){
         m=a;
          n=b; 
        }
        else{
         n=a;
         m=b; 
        }
       while(n!=0)
        {
          t = n;
          n = m%n;
          m= t;
        }
        l = a*b / m;
        cout << m << " " << l << endl;
      }
 return 0;
}

C++: #include<stdio.h>

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

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

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

C++: #include <iostream>
#include <stdio.h>

using namespace std;

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

int main()
{
	__int64 a, b, t;
	while (scanf("%I64d%I64d", &a, &b) != EOF)
	{
		if (a < b)
			t = gcd(b, a);
		else
			t = gcd(a, b);
		printf("%I64d %I64d\n", t, a * b / t);
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main(){
    int a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " ";
        cout << lcm(a, b) << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    ll a, b;
    while (cin >> a >> b) {
        ll g = __gcd(a, b);
        cout << g << " " << a / g * b << endl;
    }
    return 0;
}

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

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

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

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

int main(){
  int a, b;
  while(cin >> a >> b){

    int max = max(a, b);
    int min = min(a, b);

    long gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        j++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

C++: #include<iostream>
int e(int a,int b){return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%ld %ld\n",c,a/c*b))c=e(a,b);}

C++: #include<stdio.h>
#include<iostream>
#include<iomanip>

#define ll long long
#define REP(i, a) for(int i=0;i<(int)a;++i)
using namespace std;

ll lcm(ll a, ll b) {
    return a * (b / __algo_gcd(a, b));
}

void solver() {
    ll a,b;
    while(cin>>a>>b){
        cout<<__algo_gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
}

int main() {
    solver();
    return 0;
}

C++: #include <stdio.h>
 
int yakusuu(int a,int b);
 
int main(void){
int a,b,c;
while(scanf("%d %d",&a,&b)!=EOF){
c=yakusuu(a,b);
printf("%d %d\n",c,(a*b/c));
}
return 0;
}
 
int yakusuu(int a,int b){
int n=2,c=1;
while(n<=a && n<=b){
if(a%n==0 && b%n==0){
a=a/n;
b=b/n;
c=c*n;
}
else{
n=n+1;
}
}
return c;
}

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

int main(){
    int a,b;
    while (cin >> a >> b) {
        int koua,koub;
        koua = a;
        koub = b;
        if(koua < koub) {
            int temp = koua;
            koua = koub;
            koub = temp;
        }
        int r;
        while ((r =koua % koub) != 0) {
            koua = koub;
            koub = r;
        }
        int baia = a, baib = b;
        while(baia != baib) {
            if (baia < baib) {
                baia += a;
            }
            else {
                baib += b;
            }
        }
        cout<< koub << " " << baia << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);
int main(){
  int x,y,z;
  while(cin >>x>>y){
    z = gcd(x,y);
    cout <<z<<" "<<x/z*y<<endl;
  }
  return 0;
}
int gcd(int x, int y){
  if(y == 0) return x;
  return gcd(y,x%y);
}