Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <cassert>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

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

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

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

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(true){
		int a,b;
		cin>>a>>b;
		if(cin.eof())return 0;
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
}

C++: #include <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x/a[i]*y;
	     i++;	
	     
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[i],b[i]);
	}
}

C++: #include <stdio.h>
using namespace std;

int gcd(int num1,int num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(int num1,int num2) {
	return num1 / gcd(num1, num2) * num2;
}

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

C++: # include <iostream>

unsigned long a, b;

unsigned long gcd(unsigned long x, unsigned long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

unsigned long  lcm(unsigned long x, unsigned long y, unsigned long g) {
	return x / g*y;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

C++: #include "cstdio"
#include "cstring"
#include"algorithm"
using namespace std;
long long gcd(long long a,long long b)
{
	if(a<b)return gcd(b,a);
	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()
{
    //freopen("input.txt","r",stdin);
   	long long a,b;
   	while(scanf("%lld%lld",&a,&b)!=EOF)
   	{	
   		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
   	}

    return 0;
};

C++: #include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
long long a,b,aa,bb;
long long c,d,tmp;
while(cin>>a>>b){
        if(a < b)swap(a,b);
        aa=a;
        bb=b;
        while(b!=0){
                tmp = a%b;
                a = b;
                b = tmp;
        }
        c=aa*bb/a;
        cout<<a<<' '<<c<<endl;
}
        return 0;
}

C++: #include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

unsigned long long Greatest_Common_Divisor(unsigned long long a, unsigned long long b) {

	while (a != 0 && b != 0) {
		if (a > b) {
			a = a - b;
		}
		else {
			b = b - a;
		}
	}
	return(a + b);
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	unsigned long long a = 0, b = 0;
	std::vector<unsigned long long> GCD,LCM;

	while (std::cin >> a) {
		std::cin >> b;
		GCD.push_back(Greatest_Common_Divisor(a, b));
		LCM.push_back(a*b / GCD.back());
	}

	for (unsigned int i = 0; i < GCD.size(); i++) {
		std::cout << GCD[i] << " " << LCM[i] << std::endl;
	}

	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

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

C++: #include <iostream>

int main() {
  long a,b;

  while(std::cin >> a >> b) {
    long gcd = 1;
    long lcm = 1;

    long min;
    long cnt = 2;

    do {
      while((a % cnt == 0) && a % cnt == b % cnt) {
        a /= cnt;
        b /= cnt;
        gcd *= cnt;
      }
      min = (a < b) ? a : b;
      ++cnt;
    }while(min > cnt);

    lcm = gcd * a * b;
    std::cout << gcd << " " << lcm <<std::endl;
  }

}

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

using namespace std;

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

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

C++: #include <stdio.h>

int
main(void)
{
	char line[80];
	unsigned long a;
	unsigned long b;

	while (gets(line)) {
		if (sscanf(line, "%lu %lu", &a, &b) == 2) {
			unsigned long x = a;
			unsigned long y = b;
			unsigned long q;
			unsigned long r;
			while (true) {
				q = x / y;
				r = x - q * y;
				if (r == 0) {
					break;
				}
				x = y;
				y = r;
			}
			printf("%lu %lu\n", y, (a/y)*b);
		}
	}

	return 0;
}

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

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

int main(){
	int a, b, c, d;

	while(cin >> a >> b){
		c=gcd(a, b);
		d=lcm(a, b);

		cout << c << " " << d << endl;
	}

	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

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

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

int main(){
	int a, b, lcm, gcm;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			_a = _a % _b;
			if(_b % _a == 0){
				gcm = _a;
				break;
			}
			std::swap(_a, _b);
		}
		lcm = a / gcm * b;
		std::cout << gcm << ' ' << lcm << std::endl;
	}
	return 0;
}

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

int main(void)
{

	long a,b,ax,bx;

	while(scanf("%d %d", &a,&b) != EOF){

	if(a < b)
		swap(a,b);

	ax = a,bx = b;


	long c;
	while(ax % bx != 0){
		c = bx;
		bx = ax%bx;
		ax = c;
	}

	int ans;

	if(a % b == 0)
		ans = a;
	else
		ans = (a/bx)*(b/bx)*bx;

	cout << bx << ' ' << ans << endl;

	}

	return 0;
}