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 unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld",a)

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);
//scanf("%d",&x);
//printf("%d\n",x);

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//char ch;
//string S, T, U;
ll gcd(ll a, ll b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}


ll findGCD(ll x, ll y)
{
    ll result;

    result = gcd(x,y);
    return result;
}

ll findLCM(ll x, ll y)
{
    ll ans = x;

    ans = ( (x * y) / (gcd(x,y)) );

    return ans;
}

ll i, j, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    while(cin>>x>>y)
    {
       cout<<findGCD(x,y)<<" "<<findLCM(x,y)<<endl;
    }
    return 0;
}

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

long long int a,b,n,m;

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

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

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstdio>
#define EPS 10e-6
#define rep(i, a, b) for(int i = a; i < b; i++)
using namespace std;
typedef long long ll;
int a, b;

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

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else {
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;

  }
 }
 return 0; 
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;

		while (a % b != 0){
			r = a % b;
			a = b;
			gcd = a;
			b = r;
		}

		lcm /= gcd;

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

	return 0;
}

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

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

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

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(1) << std::endl;	
  	}
	return 0;
}

C++: #include <iostream>

#define CASE double

using namespace std;

int GCD(CASE x, CASE y)
{
	if (x == 0 || y == 0)
		return x + y;
	else
	{
		if (x >= y)
		{
			x = x - y;
			GCD(x, y);
		}
		else
		{
			y = y - x;
			GCD(x, y);
		}
	}
}

int main(){
	CASE a, b;
	unsigned long int d, l;
		cin >> a;
		cin >> b;
		d = (unsigned long int)GCD(a, b);
		l = a * b / d;
		cout << d << " " << l << endl;
	return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

long long gcd(long long x,long long y)
{
	return y ? gcd(y,x % y) : x;
}

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

ll A,B;

int main()
{
	while(~scanf("%lld%lld",&A,&B)){
		printf("%lld %lld\n",gcd(A,B),lcm(A,B));
	}

	return 0;
}

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

int main() {
    
    int a,b;
    while(cin >> a >> b){
        for(int i = a;i > 1;i--){
            if(b%i == 0 && a%i == 0){
                cout << i << "\n";
                break;
            }
        }
        for(int i = a;i < 2000000000;i++){
            if(i%a == 0 && i%b == 0){
                cout << i << "\n";
                break;
            }
        }
    }
    
return 0;
}

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

void compare(long int* a, long int* b){
  long int tem;
  if(*a < *b){
    tem = *a;
    *a = *b;
    *b = tem;
  }
}


int main(){
  long int a, b, k;
  long int x[1000][2];
  int n = 0;


  while(cin >> a >> b){
    k = a * b;
    while(1){
      compare(&a, &b);
      a = a - b;
      if(a == b)
        break;
    }
    x[n][0] = a;
    x[n][1] = k / a;
    n++;
  }

  for(int i = 0; i < n; i++)
    cout << x[i][0] << " " << x[i][1] << '\n';

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<utility>
#include<climits>
#include<cmath>
using namespace std;

int main()
{
	long a, b;
	long c, d, e;
	long gcd, lcm;


	while (cin >> a >> b)
	{	
		c = a, d = b;
		while (d != 0)
		{
			e = c % d;
			c = d; d = e;
		}

		gcd = c;
		lcm = a * b /gcd;

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

	return 0;
}