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 main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	
	long long int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	for(int j=0;j<nn;j+=2){
		long long int gcd=0,lcm=0;
		for(long long int k=1;k<n[j];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		long long int a=0,b=0;
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
}
int a,b;

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

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

int GCD( int x , int y )
{
	if( x < y ){ swap( x,y ); }

	if( x % y == 0 ){ return y ; }
	else{ GCD( y , x%=y ) ; }
}

int main()
{
	unsigned int a,b ;

	while( cin >> a >> b )
	{
		cout << GCD(a,b) << " " << a/GCD(a,b) * b ;
	}

	return 0 ;
}

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

#define PQ priority_queue
#define P pair<int,int>
#define CLA(array) memset(array,0,sizeof array)
#define CLINF(array) memset(array,0x3f,sizeof array)
#define CLF(array) memset(array,-1,sizeof array)
#define DB(a) cout << "DEBUG " << a << endl;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 100000 + 50;
const int INF = 1 << 30;
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;
}
int main(){
    LL a,b;
    while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<lcm(a,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()
{
	while(true){
		int a, b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

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

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

long long int lcm(long long int a, long long 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<cstdio>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;
/*ull gcd(ull m,ull n)
{
    ull t;
    ull a=max(n,m),b=min(n,m);
    while(1)
    {
        t=b;
        if(a%b==0) return b;
        b=a%b;
        a=t;
    }
}*/
ull gcd(ull a,ull b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main()
{
    ull a,b;
    while(~scanf("%I64d%I64d",&a,&b))
    {
        ull t=gcd(a,b);
        printf("%I64d %I64d\n",t,a*b/t);
    }
    return 0;
}

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

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  int i;
  for(i=1;i<=y;i++)
    {
      if((x*i)%y == 0)
	return x*i;
    }
  return x*y;
}



int main(void)
{
  int a,b,k;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	 k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

inline int euclid_alg(const int a, const int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

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

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

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

C++: #include "iostream"
using namespace std;
long long GCM(long long a, long long b)	
{
	long long t;
	while (b)
	{
		t = a%b;
		a = b;
		b = t;
	}
	return a;
}
long long LCM(long long a, long long b, long long x)
{
	long long  t;
	t = (a*b) / x;
	return t;
}
int main()
{
	long long a, b;
	while (1)
	{
		if (cin.eof())
			break;
		else
		{
			cin >> a >> b;
			long long m, n;
			m = GCM(a, b);
			n = LCM(a, b, m);
			cout << m << " " << n << endl;
		}
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;
#define ep 0.00001

int main()
{
	int a, b, temp;
	int a1, b1;
	int gcd, lcm;
	
	while (cin >> a >> b) {
		if (a > b) {
			temp = a;
			a = b;
			b = temp;
		}
		for (int i = b; i >= 1; i--) {
			if ((a % i == 0) && (b % i == 0)) {
				gcd = i;
				break;
			}
		}
		a1 = a;
		b1 = b;
		while (a1 != b1) {
			if (a1 < b1)
				a1 += a;
			else if (a1 > b1)
				b1 += b;
		}
		lcm = a1;
		cout << gcd << " " << lcm << "\n";
	}
	return 0;
}

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

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

int main() {
  int x,y;
  while(cin >> x >> y) {
    int a = gcm(x,y);
    cout << a << " " << x/a*y << endl;
  }
}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;

long long gcd(long long a,long long b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b)
{
    return a*b/gcd(a,b);
}

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

C++: #include <iostream>
using namespace std;
int gcd(int a,int b){
    if(a%b)return gcd(b,a%b);
    else return b;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        cout << gcd(a,b) << " " << a/gcd(a,b)*b << endl;
    }
}

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(aa != 0){
int c = 0;
bb = bb % aa;
c = aa;
aa = bb;
bb = c;
}
int P = a * b;
cout << bb << " " << P / bb << endl;

}
    return 0;
}