Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

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

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

	while ( cin >> a >> b ){

		if ( a >= b ){
			x = a;
			y = r = b;
		}else{
			x = b;
			y = r = a;
		}

		while ( 1 ){
			r = x % y;
			if ( !r ) break;
			x = y;
			y = r;
		}

		x = ( a * b ) / y;

		cout << y << " " << x << endl;
	}

	return 0;
}

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

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

int main(void)
{
	long long x,y;
	while(cin >> x >> y){
	cout << gcd(x,y) << " " << x*y/gcd(x,y)<< endl;
	}
	return(0);
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __lcm(n, m));
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
	while(m!=n)m>n?m-=n:n-=m;
  		//if (m>n) m = m - n;
  		//else n = n - m;
	return m;
}
ll lcm(ll m,ll n){return ((m/gcd(m, n))*n);}
int main(){
	ll a,b;
	while(cin>>a>>b)cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
}

C++: #include "bits/stdc++.h"
#include <gmp.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;
        read(a,b);
        ull r1=gcd(a,b);
        ull r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}

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

C++: #include <iostream>
using namespace std;
int gcd(int x,int y){
	if(x==0)return y;
	return gcd(y%x,x);
}
int main(){
	while(!cin.eof()){
		int a,b;
		cin>>a>>b;
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b;
	}
	return 0;
}

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

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);++i)

ll a,b;
ll tmp;

ll gcd(ll a,ll b){
	if((0==a)||(0==b)) return 0;
	
	while(a!=b){
		if(a>b) a -= b;
		else b -= a;
	}
	return a;
}

ll lcm(ll a,ll b){
	if((a==0)||(b==0)) return 0;
	
	return ((a/tmp) * b);
}

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

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

int main() {
	int a = 0;
	int b = 0;
	int max = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
		}
		else {
			max = a;
		}
		a_bk = a;
		b_bk = b;
		d = 1;
		for (int c = 2; c <= max; c++) {
			while (a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
			}
		}
		a = a_bk / d * b_bk;
		cout << d << ' ' << a << "\n";
	}
	return 0;
}

C++: //#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	return 0;
}

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

int main() {
	int a, b, gcd, lcm;
	while(cin >> a >> b){
		gcd = 1;
		lcm = 1;
		for(int i = 2; a != 1 || b != 1; i++) {
			while(a % i == 0 || b % i == 0) {
				if(a % i == 0 && b % i == 0){
					a = a / i;
					b = b / i;
					gcd = gcd * i;
					lcm = lcm * i;
				} else if(a % i == 0) {
					a = a / i;
					lcm = lcm * i;
				} else if(b % i == 0) {
					b = b / i;
					lcm = lcm * i;
				}
			}
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}