Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

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

int main(){
	int a, b, c, d;

	while(cin >> a >> b){
		c=gcd(a, b);
		d=lcm(a, b);

		cout << c << " " << d << endl;
	}

	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

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

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>
#include <stdio.h>
using namespace std;

int main(void)
{

	long a,b,ax,bx;

	while(scanf("%d %d", &a,&b) != EOF){

	if(a < b)
		swap(a,b);

	ax = a,bx = b;


	long c;
	while(ax % bx != 0){
		c = bx;
		bx = ax%bx;
		ax = c;
	}

	int ans;

	if(a % b == 0)
		ans = a;
	else
		ans = (a/bx)*(b/bx)*bx;

	cout << bx << ' ' << ans << endl;

	}

	return 0;
}

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

int main(){
		long long a, b, m, n, r;
		while(cin >> a >> b){
				if(a == b){
						cout << a << " " << a << endl;
				}
				else if(a > b){
						m = a;
						n = b;
						while(r = m % n){
								m = n;
								n = r;
						}
						cout << n << " " << (a * b) / n << endl;
				}
				else if(a < b){
						m = b;
						n = a;
						while(r = m % n){
								m = n;
								n = r;
						}
						cout << n << " " << (a * b) / n << endl;
				}
		}
		return 0;
}

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

using namespace std;

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

    return 0;


}

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

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

using namespace std;

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

int main(void){

  int a,b;

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

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

int main(){
const int INF=1000000;
int a[INF];
int gcd,lcm;
while(cin>>a[0]>>a[1]){
for(int i=0;i<INF;i++){
if(a[i]>a[i+1]){a[i+2]=a[i]-a[i+1];}
if(a[i+1]>a[i]){a[i+2]=a[i+1]-a[i];}
if(a[i+1]==a[i]){gcd=a[i]; break;}}
lcm=a[0]*a[1]/gcd;
cout<<gcd<<" "<<lcm<<endl;}}

C++: #include <stdio.h>
int main(void){
    int a,b,d;
    while(~scanf("%d%d",&a,&b)){
        int&t=a<b?a:b,n=1;
        d=t;
        while(d>1){
            if(a%d||b%d)d--;
            else a/=d,b/=d,n*=d,d=t;
        }
        printf("%d %d\n",n,n*a*b);
    }
    return 0;

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int main(){
	ios::sync_with_stdio(false);

	llong a, b, gcd, lcm, tmax, tmin;
	vl ar(2);

	while (cin >> a >> b){
		ar[0] = a;
		ar[1] = b;

		while (ar[1]!=0){
			VSORT(ar);
			ar[1] = (int)fmod(ar[1], ar[0]);
		}
		gcd = ar[0];
		lcm = a*b / gcd;

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

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;
}