Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: #include <iostream>

int  main() {

	//?????§??¬?´???° =????????????????????????????????????
	/*(1) a ??? b ??§???????????????????????? r ?????\????????????
	???(2) r ??? 0 ?????? b ????????§??¬?´???°??§?????????????????????????????????
	???(3) ????????§????????¨????????°a = b?????°b = r ??¨?????? (1) ???????????????????????????*/

	 //????°???¬?????° =???a*b???/???a??¨b????????§??¬?´???°?????§?±?????????????
	long long  a = 0, b = 0, ad = 0, bd = 0, swap, amari, koba = 0;
	std::cin >> a >> b;
	ad = a; bd = b;
	if (b >= a) { swap = a; a = b; b = swap; }
		
	a:
		amari = a%b;
		if (amari == 0) {
			std::cout << b << " ";
			std::cout << ad*bd / b << std::endl;
		}
		else {
			a = b;
			b = amari;
			goto a;
		}
}

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

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

int main() {
  int x,y;
  while(cin >> x >> y) {
    int a = gcm(x,y);
    cout << a << " " << x*y/a << endl;
  }
}

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

using namespace std;

void solve(int a, int b) {
	int max_num = max(a,b);
	int p[max_num]; int count = 2;
	bool f;
	for (int i=2; i<max_num; i++) {
		if (i == 2) {
			p[0] = 2;
		} else if (i == 3) {
			p[1] = 3;
		} else {
			for (int j=0; j<sizeof(p); j++) {
				if (i%p[j]==0) {
					f = false;
				}
			}
			if (f) {
				p[count] = i;
				count++;
			}
		}
	}
	int gcj = 0;
	for (int i=0; i<sizeof(p); i++) {
		if (a%p[i]==0 && b%p[i]==0)
			gcj = max(gcj, p[i]);
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
typedef long long Int;
Int gcd(Int a, Int b)
{   
  return b != 0 ? gcd(b, a % b) : a; }

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

main() {
  Int a,b;
  while((cin>>a>>b)) {
    Int gc = gcd(a,b);
    cout << gc << " " << a*b/gc << endl;
  }
}

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

long long main() {
	int a,b,e,f;
	while(cin>>a>>b){
		int l;
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	break;
	    }
		}
	}
	return 0;
}

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;
}