Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	int a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << a / gcd(a, b)*b << endl;
	}
}

C++: /* -*- coding:utf-8 -*- */

#include <iostream>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main(void)
{
  int a, b;
  while(cin >> a >> b, !cin.eof()) 
    cout << boost::math::gcd(a,b) << ' ' << boost::math::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 <iostream>
using namespace std;

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a)
}

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

C++: #include <iostream>
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 a, b;
    while (cin >> a >> b) {
        if (a >= b) cout << GCD(a, b) << " " << LCM(a, b) << endl;
        else cout << GCD(b, a) << " " << LCM(b, a) << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	int a, b;
	int MAX, MIN;
	int kari;
	int GCD, LCM;
	while (cin >> a >> b) {
		MAX = max(a, b);
		MIN = min(a, b);
		while(1) {
			kari = MAX % MIN;
			if(kari == 0) {
				GCD = MIN;
				break;
			}
			MAX = MIN;
			MIN = kari;
		}

		LCM = (a / GCD) * (b / GCD) * GCD;

		printf("%d %d\n", GCD, LCM);
	}
	return 0;
}

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

int a,b;

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

int main(){
	while(scanf("%d%d",&a,&b)==2){
		int G=gcd(a,b);
		int L=a/G*b;
		printf("%d %d\n",G,L);
	}
	
	return 0;
}

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

using namespace std;

typedef long long int llongi;

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

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

C++: #include <iostream>
#include <math.h>
using namespace std;
int main() {
	while (1) {
		int a, b, i, GCD, LCM;
		cin >> a >> b;
		for (i = 1; i <= a || i <= b; i++) {
			if (a % i == 0 && b % i == 0) {
				GCD = i;
			}
		}
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(1) << std::endl;	
  	}
	return 0;
}

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

ll p_cal_gcd(ll big, ll small)
{
    if(small == 0) return big;
    else return p_cal_gcd(small, big % small);
}

ll cal_gcd(ll a, ll b)
{
    return a > b ? p_cal_gcd(a, b) : p_cal_gcd(b, a);
}

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