Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}}
ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ull a,b;
        cin>>a>>b;
        if(a==0)return 0;
        ull r1=gcd(a,b);
        ull r2=a*b/r1;
        printf("%lld %lld\n",r1,r2);
    }
    return 0;
}

C++: #include<stdio.h>


int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;
		while(i==j){
			if(i>j){
				i=i-j;
			}else{
				j=j-i;
			}
		}
		y=x*y/i;
		x=i;


		printf("%lld %lld\n",x,y);
	}

	return 0;
}

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

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

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

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 <iostream>

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

int main(void) {
    int a;
    int b;
    int g;
    while (std::cin >> a >> b) {
        g = gcd(a, b); 
        std::cout << g << std::endl; 
        std::cout << (int)((double)a / (double) g * (double)b) << std::endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long long a,b,c,d;
std::cin>>a>>b;
d=a*b;	
if(b>a){
long long d;
d = a;
a = b;
b = d;}
while(b!=0){
c = a % b;
a = b;
b = c;}
std::cout<<a<<" "<<d/a;
}

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = i*j/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	if(i % j ==0){
		return j;
	}
	
	i %= j;
	int tmp;
	tmp = i;
	i = j;
	j = tmp;
	return gcd(i, j);
}

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

int GCD(int x,int y) {
    if (x<y) {
        swap(x,y);
    }
    if (y==0) {
        return x;
    }
    return GCD(y,x%y);
}
int LCM(int x,int y) {
    return x*y/GCD(x,y);
}
int main() {
    int a, b;
    while (cin >> a >> b) {
        printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
    return 0;
}

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

int gcd(int m,int n){
	if(n==0)
		return m;
	
	return gcd(n,m%n);
}

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 <iostream>
#include <cstdio>
using namespace std;

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

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

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

#define ull unsigned long long

ull mcd(ull a,ull b){
	ull r = a%b;
	ull q = b;
	while(r>0){
		ull c = r;
		r = q%r;
		q = c;
	}
	return q;
}

int main(){
	ull n,m;
	while(cin>>n>>m){
		ull w = mcd(max(n,m),min(n,m));
		cout<<w<<" "<<(n*m)/w<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

int main(){
	int a, b;

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

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

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

int YUK(int x, int y){
	int c;
		c = x%y;
		if(c == 0){
			return y;
		}else{
			return YUK(y,c);
		}
}

int main(){
	int a, b;

	while( cin >> a >> b ){
		int d;
		if(a >= b){
			d = YUK(a,b);
			cout << d << '\n' << SKB(a,b,d);

		}else{
			d = YUK(b,a);
			cout << d << '\n' << SKB(a,b,d);
		}
		cout << '\n';
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
#define ull unsigned long long

ull gcd(ull a, ull b) {
    if (a == b) return a;
    if (a > b) {
        return gcd(a - b, b);
    } else {
        return gcd(a, b - a);
    }
}

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

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