Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % i == 0 && b % i == 0) {
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: //
//  main.cpp
//  CppTest
//
//  Created by Ryu on 2017/02/08.
//  Copyright ?? 2017??´ Ryu. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

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

int main(int argc, const char * argv[]) {
    // insert code here...
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    long a[50], b[50], g[50], l[50];
    int n = 0;
    while (cin >> a[n] >> b[n]){
        g[n] = gcd(a[n], b[n]);
        l[n] = a[n] * b[n] / g[n];
        //printf("d: %f, x: %.4f, y: %.4f\n", d, x[n], y[n]);
        n++;
    }
    
    
    for(int i = 0; i < n; i++){
        printf("%ld %ld\n", g[i], l[i]);
    }
    
    
    return 0;
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

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

typedef long long lli;

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

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

int main() {
  lli a, b;

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

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

double gcd(double m,double n);
double lcm(double m,double n);

int main(){
	int i;
	double a,b;
	double z[10] ={0} ;
	double y[10] = {0} ;


	for(i=0;i<4;i+=2){
		while(1){
			cin >> a >> b ;
			z[i] = a ;
			z[i+1] = b ;

			if((z[i] <= 200000000) && (z[i] > 0 )){
				if((z[i+1] <= 2000000000) && (z[i+1] > 0)) break;
			}
		}


	}

	y[0] = gcd(z[0],z[1]) ;
	y[1] = lcm(z[0],z[1]) ;
	y[2] = gcd(z[2],z[3]) ;
	y[3] = lcm(z[2],z[3]) ;

	cout << y[0] << " "<< y[1] << "\n" ;
	cout << y[2] << " " << y[3] << endl ;
	return 0;
}

	double gcd( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

C++: #include<iostream>

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

int main(){
  int a, b;

  while(std::cin >> a >> b){
    std::cout << (a*b)/gcd(a,b) << " " << gcd(a,b) << std::endl;
  }
}