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>
#include <xiosbase>
using namespace std;
long long gcd(long long a,long long b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
long long kmm(long long a,long long b)
{
    return a*b/gcd(a,b);
}
int main()
{
	system("CLS");
    long long a,b;
    cin>>a>>b;
	while(!cin.eof())
	{
	cout<<gcd(a,b);
	cout<<" ";
	cout<<kmm(a,b);
	cout<<endl;
	cin>>a>>b;

	}
    return 0;
}

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

using namespace std;

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

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

int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %lld\n", gcd(a, b), lcm(a, b));
    }
}

C++: #include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  whie(scanf("%d%d",&a,&b) != EOF){
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);
  }

  return 0;
}

C++: #include<iostream>
#define max(a,b) a>b ? a : b
#define min(a,b) a<b ? a : b
using namespace std;

typedef long long ll;

ll LCM(ll a, ll b)
{
	ll result;
	ll n1 = max(a, b);
	ll n2 = min(a, b);
	for (int i = 1;; i++)
	{
		result = n1*i;
		if (result%n2 == 0)
			return result;
	}
}

ll GCD(ll a, ll b)
{
	while (true)
	{
		int ma = max(a, b), mi = min(a, b);
		if (ma%mi == 0)
			return mi;
		else
		{
			ma -= mi;
			return GCD(ma, mi);
		}
	}
}

int main()
{
	ll n1, n2;
	while (cin >> n1 >> n2)
		cout << GCD(n1, n2) << ' ' << LCM(n1, n2) << endl;
	return 0;
}

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

int main() {
	
	int a,b,m,g;
	
	while(cin>>a>>b){
		if(a>b)m=a; else m=b;
		for(int i=m;i>0;i--){
			if(a%i==0&&b%i==0){
				g=i;
				break;
			}
		}
		cout<<g<<" "<<a/g*b<<endl;
	}
	
	return 0;
}

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

using namespace std;

long long a, b;

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(void) {
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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

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

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

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

C++: #include <stdio.h>

int main(){
long int a,b;
long int x,y,i,j;

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=b;i>0;i--){
if(a%i==0 && b%i==0){
x=i;
break;
}
}
}
else if(b>a){
for(i=a;i>0;i--){
if(a%i==0 && b%i==0){
x=i;
break;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=b*i;
break;
}
}
if(b*i==a*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

C++: /*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
  string xyz ="";
int x=0,y=0,z=0,w=0,i=0,j=0,n=0;
while(std::cin >> x>>y){
  z=x*y;
  w=x%y;
  while(w!=0){
    x=y;
    y=w;
    w=x%y;
  }
  std::cout <<y <<" "<<z/y<< '\n';
}

}

C++: #include <stdio.h>

int gcd(int a, int b){
	int t;
	while((a % b) != 0){
		t = b;
		b = a % b;
		a = t;
	}
	return b;
}

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

C++: #include <iostream>
using namespace std;
int LCM(int a, int b);
int GCD(int a, int b, int ans1);

int main(){
    int a,b;
    while(cin >> a >> b){
        int ans1 = LCM(a,b);
        int ans2 = GCD(a,b,ans1);
        cout << ans1 << " " << ans2 << endl;
    }
}

int LCM(int a, int b){
    int r;
    if(a < b){
        int tmp = a;
        a = b;
        b = tmp;
    }
    while(1){
        r = a % b;
        if(r == 0) break;
        a = b;
        b = r;
    }
    
    return b;
}

int GCD(int a, int b, int ans1){
    int ans = b / ans1 * a;
    return ans;
}

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

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

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

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

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << lcm << std::endl;
	}
	
	return 0;
}

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


unsigned int gcd(unsigned int a, unsigned int b) {
	unsigned int r;

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

	return a;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

int main() {
	unsigned int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans = 0;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = (b / 2); i >= 1; i--)
		{
			if (a%i == 0 && b%i == 0) {
				maxans = i;
				break;
			}
		}
		for (long long int i = 1; i <= a; i++)
		{
			if ((i*b) % a == 0) {
				minans = i*b;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

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

    }
}