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 <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

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

int main(){
    int a, b;
    while(cin>>a>>b){
    	int g = gcd(a,b);
    	printf("%d %d\n", g, a*(b/g));
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << 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; }

template<class T>T gcd(T a, T b) {if(b==0) return a; return gcd(b, a%b);}

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

int main()
{
    ll a, b;
    while(cin >> a>>b) printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    return 0;}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

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

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

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

C++: #include <stdio.h>
 
using namespace std;
 
int calcMax(int a,int b){
    int tmp;
    if(a > b){
        while(b != 0){
            tmp = b;
            b = a%b;
            a = tmp;
        }
        return a;
    }else{
        while(a != 0){
            tmp = a;
            a = b%a;
            b = tmp;
        }
        return b;
    }
}
 
 
 
int calcMin(int a,int b){
    int max_common = calcMax(a,b);
    return (a/max_common)*b;
}
 
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        printf("%d %d\n",calcMax(a,b),calcMin(a,b));
    }
 
    return 0;
}

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

int main(){
    int a, b, lcm, gcd;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			if(_b % _a == 0){
				gcd = _a;
				break;
			}
			_a = _a % _b;
			std::swap(_a, _b);
		}
		lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: 
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	long long a, b;
	while (cin >> a >> b)
	{
		int A, B;
		A = saisho(a,b);
		B = saidai(a, b);
		cout << A << " " << B<<endl;
	}
	return 0;

}
int saidai(int N, int M)
{
	int n = N, m = M;

	int s = 1;
	while (true)
	{
		if ((s*n) % m == 0)
		{
			break;
		}
		else { s++; }
	}
	return s*n;
}

int saisho(int N, int M)
{
	int n = N, m = M;
	while (true)
	{
		if (n == 0) { return m; break; }
		if (m == 0) { return n; break; }
		if (n > m) { n -= m; }
		else { m -= n; }
	}
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

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

int main(){
	int a,b;
	while(cin>>a>>b){
		int a2=a;
		int b2=b;
		while(true){
			if(a>b){
				a=a%b;
			}else{
				b=b%a;
			}
			if(a==0||b==0)break;
		}
	cout<<max(a,b)<<" "<<a2/max(a,b)*b2<<endl;
	}
	return 0;
}

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

int main() {
	
	int a, b;
	int lcm, gcd;
	for (int j = 0;j < 50;j++) {
		cin >> a >> b;
		int i = 2;
		lcm = 1;
		while (i <= a && i <= b) {
			if (a % i == 0 && b % i == 0) {
				lcm *= i;
				a /= i;
				b /= i;
			}
			else i++;
		}
		printf("%d %d\n", lcm, a * b * lcm);
	}

	//system("pause");
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    }
    
    cout << small << ' ' << (a / small) * (b / small) * small << endl; 

    return 0;
}

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

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

 GCD(b, a%b);
}

int LCM(int a, int b)
{
 int c = GCD(a, b);

 return a*b/c;
}

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

 cout << GCD(a, b) << ' ' << LCM(a, b) << '\n';

 return 0;
}

C++: 
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
    
#define ll (long long)
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)


using namespace std;


int main(void)
{
    
    int  number1, number2;
    long long answer2 = 0; int answer1;
    int temp;
    int i;
    long long answer2array[1000] = {1};
    int answer1array[1000] = {0};
    int counter = 0;
    
    while(cin >> number1 >> number2)
    {
        /*?????§??¬?´???°???????±???????*/
        int x = 0, y = 0, x2 = 0, x1 = 0;
        if(number1 > number2)
        {
            x = number1;
            y = number2;
            x1 = x;
            x2  = y;
        }
        else
        {
            x = number2;
            y = number1;
            x1 = x;
            x2 = y;
            
        }
        while(x % y)
        {
            temp = (x % y);
            x = y;
            y = temp;
        }
        answer1 = y;
        /*????°???¬?????°????±???????*/
        for(i = 1;i<=x2;i++)
        {
            if((x1*i)%x2 == 0)
            {
                answer2 = (long long)(x1*i);
                break;
            }
        }
        
        answer2array[counter] = answer2;
        answer1array[counter] = answer1;
        counter++;
        }
        REP(i, counter)
    cout << answer1array[i] << " " << answer2array[i] << endl;
    return 0;
    

    }

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a/__gcd(a,b)*b);
    }
    return 0;
}