Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

int main(){
  long a, b;
  long ca, cb, tmp;
  long gcd, lcm;

  while(cin >> a){
    cin >> b;
    ca=a; cb=b;

    if(ca<cb){
      tmp=ca; ca=cb; cb=tmp;
    }

    while(cb!=0){
      ca%=cb;
      if(ca==0){
        ca=cb;
        break;
      }
      cb%=ca;
    }
    gcd=ca;
    lcm=a*b/gcd;

    printf("%d %d\n", gcd, lcm);
  }

  return 0;
}

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

int main() {
	for(long long a, b; scanf("%lld %lld", &a, &b) == 2;) {
		long long g = __gcd(a, b);
		printf("%lld %lld\n", g, a / g * b);
	}

	return EXIT_SUCCESS;
}

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	int i,j;
	
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd <<" " << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

C++: #include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long int a,b,n,lcm;
    while (scanf ("%lld %lld",&a,&b)!=EOF)
    {
        n=__gcd(a,b);
        lcm=(a*b)/n;
        cout<<n<<" "<<lcm<<endl;
    }
}

C++: #include <iostream>
 
typedef unsigned int ui;
 
void swap(ui & a, ui & b)
{
    unsigned int tmp = a;
    a = b;
    b = tmp;
}
 
ui gcd(ui a, ui b)
{
    if (a < b) swap(a, b);
 
    ui c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
 
    return b;
}
 
int main() {
    using namespace std;
 
    ui a, b;
    while (cin >> a >> b) {
        const ui GCD = gcd(a, b);
        const ui LCM = a * (b / GCD);
        cout << GCD << ' ' << LCM << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }
int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}
int lcm(int x,int y){
	return x/gcd(x,y)*y;
}
signed main(){
	int a,b;
	while(cin>>a>>b){
		cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
	}
}

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;

int Greatest_Common_Divisor(int a, int 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 int a = 0, b = 0;
	std::vector<unsigned int> GCD, LCM;

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

	for (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++: int main(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

C++: #include<stdio.h>
long long fan(long long a,long long b)
{
    if(b==0)
        return a;
    else
        return fan(b,a%b);
}
int main()
{
    long long a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    printf("%lld %lld\n",fan(a,b),a/fan(a,b)*b);
    return 0;
}

C++: import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a,b;
		while(true){
			a = cin.nextInt();
			b = cin.nextInt();
			System.out.println(gcd(a,b)+" "+lcm(a,b));
		}
	}

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

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long r=1;
	while(1){
		r=a%b;
		if(r==0)break;
		a=b;
		b=r;
	}
	return b;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int gcd(int x, int y)
{
	if (x%y == 0)
		return y;
	if (x < y)
		swap(x, y);
	return gcd(y, x%y);
}
int main()
{
	int n, m;
	while (scanf("%d %d", &n, &m)!=EOF);
	{
		cout << gcd(n, m) <<" "<< n / gcd(n,m) * m << endl;
	}
}

C++: #include<iostream>
using namespace std;
long long gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  while(cin>>a>>b){

  c=gcd(a,b);
  d=a*(b/c);
  cout<<c<<' '<<d<<endl;
  }
  return 0;
}

long long gcd(long long x,long long y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;
}

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

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

long lcm(long m, long n) {
    if(m == 0 || n == 0) return(0);
    return((m * n) / gcd(m, n));
}

int main(void) {
    long a, b;
    while(scanf("%ld %ld", &a, &b) != EOF) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return(0);
}

C++: #include<stdio.h>
#include<math.h>
int main()
{
    unsigned long long int b,a,GCD,LCM,m,temp;
    while(scanf("%llu %llu", &a, &b) != EOF) {
        m = a*b;
        {


        while(b != 0)
        {
            temp = b;
            b = a%b;
            a = temp;
        }
        GCD = a;
      }

    LCM = (m/GCD);

    printf("%llu %llu",GCD, LCM);
     }
    return 0;
}