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 <iostream>

using namespace std;

int gcd1(int a,int b){
	while(a != b){
		if(a>b)
			a = a - b;
		else
			b = b - a;
	}
	return a;
}

int gcd2(int a,int b){
	int w;
	while(b != 0){
		w = a % b;
		a = b; b = w;
	}
	return a;
}

int lcm(long long a,long long b){
	return a * b / gcd2(a,b);
}

int main(void){
	int a,b;
	while(cin >> a >> b){
		cout << gcd2(a,b) << " " <<lcm(a,b) << "\n";//最大公約数
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
typedef long long int ll;

using namespace std;


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

int main(){
	while(1){
		ll a,b;
		if( !(cin>>a>>b) )break;
		ll g=gcd(a,b);
		cout<<g<<" "<<a*b/g<<endl;
	}
	return 0;
}

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

using namespace std;

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

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

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

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

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

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

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

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

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

int main()
{
  int a,b;
  while(cin >> a >> b){
    int GCD,LCM;
    int temp;
    if(a<b){
      temp = a;
      a = b;
      b = temp;
    }
    for(int i=1; i<=b; i++){
      if( b%i==0 && a%(b/i)==0 ){
	GCD = b/i;
	break;
      }
    }
    for(int i=1; i<=b; i++){
      if( (a*i)%b == 0 ){
	LCM = a*i;
	break;
      }
    }
    cout << GCD << " " << LCM << endl;
  }
  return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main(){
    long a,b;
    a=0;b=0;
    cin >> a >> b;
    if(a<b) {
        long c;
        c=a;
        a=b;
        b=c;
    }
    long answer;
    long d,e,f;
    for(;;){
         if(e==f){
             answer = a*b/f;
             break;
         }
         d=e-f;
         e=f;
         f=d;
    }
    cout<<f<<" "<<answer<<endl;
    return 0;
}

C++: #include <cstdio>
using namespace std;
long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

int main()
{
	long long int a, b;
	while (scanf("%lld %lld",&a,&b) != EOF) {
		if (a >= b)
			printf("%lld %lld\n",gcd(a, b),a*b/ gcd(a, b));
		else
			printf("%lld %lld\n", gcd(b, a), a*b / gcd(b, a));
	}
	return 0;
}

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { std::cin >> first; Scan(rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define IN(a, x, b) (a<=x && x<=b)
#define SHOW(d) {std::cout << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cout << #v << "\t:";for(const auto& i : v){std::cout << i << " ";}std::cout << "\n";}
#define SHOWVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout << j << " ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout<<'('<<j.first<<", "<<j.second<<") ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& i:v){std::cout<<'('<<i.first<<", "<<i.second<<") ";}std::cout<<"\n";}
#define CHECKTIME(state) {auto start=std::chrono::system_clock::now();state();auto end=std::chrono::system_clock::now();auto res=std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count();std::cerr<<"[Time:"<<res<<"ns  ("<<res/(1.0e9)<<"s)]\n";}
#define SHOWQUEUE(a) {std::queue<decltype(a.front())> tmp(a);std::cout << #a << "\t:";for(int i=0; i<static_cast<int>(a.size()); ++i){std::cout << tmp.front() << "\n";tmp.pop();}std::cout << "\n";}

//#define int ll
using ll = long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000000001;
constexpr int MOD = 1000000007;

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

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

int main() {
	INIT;
	ll a, b;
	while (std::cin >> a >> b) {
		OUT(gcd(a, b))SP OUT(lcm(a, b))BR;
	}
	return 0;
}

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

int gcd(int a, int b) {
    int r;
    do{
        r=a%b;
        a=b;
        b=r;
    }while(r != 0);
    
    return a;
 }

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

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

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

int main(void)
{
	long a, b;

	while(cin >> a >> b) {
		long G, L;
		
		G = gcd(a, b);
		L = a / G * b;
		cout << G << " " << L << endl;
	}

	return 0;
}