Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

void inputData(vector<string>& data_set) {
	string buffer;
	while(getline(std::cin,buffer))
		data_set.push_back(buffer);
}

vector<string> splitString(const string& str, const string& separator = " ") {
	vector<string> ret;

	std::size_t bp, ep;
	bp = ep = 0;
	while((ep = str.find_first_of(separator, bp)) != string::npos){
		if(bp != ep){
			ret.push_back(string(str.begin() + bp, str.begin() + ep));
		}
		bp = ep + 1;
	}

	if(bp <= str.size() - 1){
		ret.push_back(string(str.begin() + bp, str.end()));
	}

	return ret;
}

template <class T>
T convertStringToNumber(const string& str) {
	stringstream ss;
	T ret;

	ss << str;
	ss >> ret;

	return ret;
}



vector<int> parseStringData(const string& data_str) {
	auto buff = splitString(data_str);

	vector<int> ret(buff.size());
	for(int i = 0; i < buff.size(); ++i){
		auto temp = convertStringToNumber<int>(buff[i]);
		ret[i] = temp;
	}

	return ret;
}


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


void displayAnswer(int a, int b) {
	int gcd = calcGCD(a, b);
	int lcm = gcd * (a/gcd) * (b/gcd);
	std::cout << gcd << " " << lcm << std::endl;
}


void doAllProcess() {
	vector<string> buffer;
	inputData(buffer);

	for(int i = 0; i < buffer.size(); ++i){
		auto data_set = parseStringData(buffer[i]);

		int a, b;
		if(data_set[0] > data_set[1]) {
			a = data_set[0];
			b = data_set[1];
		}
		else {
			a = data_set[1];
			b = data_set[0];
		}

		displayAnswer(a, b);
	}
}


int main() {
	doAllProcess();

	return 0;
}

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

typedef long long ll;

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

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

C++: #include <stdio.h>

int main(void) {
	int a, b, x, y, n, m, max, i;
	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b){
			n = a;
			m = b;
		}
		else{
			n = b;
			m = a;
		}
		for(i = 1; i <= n; i++){
			if(a % i == 0 && b % i == 0) x = i;
		}
		max = a * b;
		y = max / x;
		printf("%d %d\n", x, y);
	}
	return 0;
}

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

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

int main()
{
  int a, b, lcm, gcd;

  while (cin >> a >> b){

    if (a > b){
      int c = a;
      a = b;
      b = c;
    }

    lcm = LCM(a, b);
    gcd = a / lcm * b;

    cout << lcm << " " << gcd << endl;
  }
}

C++: #include<cstdio>
typedef unsigned long long ll;
int gcd(int a,int b)
{
	if(b==0)return a;
	else return gcd(b,a%b);
}
int main()
{
	ll n,m;
	while(scanf("%d%d",&n,&m)==2)
	{
		ll d = gcd(n,m),ll ans = n/d*m;
		printf("%lld %lld\n",d,n*m/d);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int a, b;
	while (cin >> a >> b){
		int i, GCD, LCM;
		GCD = 0;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a || i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

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

int main(){
int a;
int b;
int c;
int d;
int e;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a&b;
a=b;
b=c;
if(b=0){break;}
}
cout << a <<" ";
cout << (d*e)/a <<endl;}}

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		printf("%d\n",a*b);
		B = b;

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		m = a / b;
		m *= B;
		printf("%d\n",m); 
	}

	return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

void func()
{

	int a,b, g, l;
	while (cin >> a >> b, !cin.eof())
	{
		int d[2] = { max(a, b), min(a, b) };
		while (d[1] != 0)
		{
			d[0] %= d[1];
			swap(d[0], d[1]);
		}
		g = d[0];

		l = max(a, b) / g*min(a, b);
		cout << g << space << l << endl;
	}
}

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

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

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

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%d %d",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int gcd(int a,int b){
	if(a<b)swap(a,b);
	while(b!=0){
		int c = a%b;
		a=b;
		b=c;
	}
	return a;
}

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

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

C++: #include <iostream>
#include <cmath>
int GCD(int a, int b) {
	while (b != 0) {
		int r = a%b;
		a = b;
		b = r;
	}
	return a;
}
int main() {
	int a, b;
	while (std::cin >> a >> b) {
		int gcd = GCD(a, b);
		int lcm = round((double)a/gcd*b);
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long n, m;
long long getGCD(long long a, long long b) {
  if (b == 0) return a;

  return getGCD(b, a % b);
}
int main() {
  freopen("in", "r", stdin);
  while (cin >> n >> m) {
    long long lcm, gcd;
    if (n < m) swap(n, m);
    gcd = getGCD(n, m);
    lcm = n * m / gcd;
    //cout << "debug" << endl;
    cout << gcd << " " << lcm << endl;
  }
  return 0;
}

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

using ULLint = unsigned long long int;

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

int Glcd(ULLint x, ULLint y, int gcd) {
	return x * y / gcd;
}

int main() {
	ULLint a, b;
	while (cin >> a >> b)
		cout << Egcd(a, b) << " " << Glcd(a, b, Egcd(a, b)) << endl;
	return 0;
}