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 a1,a2;
int gcd,lcm;

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

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
long long int gcd(int a,int b) {
  if (a % b == 0) return b;
  else return gcd(b, a % b);
}
int main() {
  long long int a, b;
	while(cin >> a >> b) {
	  cout << gcd(a, b) << " " << (a*b)/gcd(a, b) << endl;
	}
  return 0;
}

C++: #include<iostream>

bool listen_numbers(int &,int &);

class Nums
{
private:
	int a,b;//a>=b
	int gcd;
	int lcm;
	
	void calc_gcd();
	void calc_lcm();
public:
	Nums(int,int);
	void echo_gcd();
	void echo_lcm();
};

Nums::Nums(int x,int y)
{
	if(x>=y)
	{
		this->a=x;
		this->b=y;
	}
	else
	{
		this->a=y;
		this->b=x;
	}
	
	this->gcd=0;
	this->lcm=0;
	
}

void Nums::calc_gcd()
{
	int rest1=this->a;
	int rest2=this->b;
	
	int tmp;
	while(rest1!=0 && rest2!=0)
	{
		tmp=rest1%rest2;
		rest1=rest2;
		rest2=tmp;
	}
	this->gcd=rest1;
}

void Nums::calc_lcm()
{
	if(this->gcd==0)
	{
		this->calc_gcd();
	}
	
	this->lcm=(int)((double)this->a*this->b/this->gcd);
}

void Nums::echo_gcd()
{
	if(this->gcd==0)
	{
		this->calc_gcd();
	}
	std::cout<<this->gcd;
}

void Nums::echo_lcm()
{
	if(this->lcm==0)
	{
		this->calc_lcm();
	}
	std::cout<<this->lcm;
}

int main()
{
	int a,b;
	
	for(;listen_numbers(a,b);)
	{
		Nums num=Nums(a,b);
		
		num.echo_gcd();
		std::cout<<" ";
		
		num.echo_lcm();
		std::cout<<std::endl;
	}
	
	return 0;
}

bool listen_numbers(int &a,int &b)
{
	using namespace std;
	
	cin>>a>>b;
	
	if(cin.eof())
	{
		return false;
	}
	else
	{
		return true;
	}
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

long __gcd(long a, long b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

long gcd(long a, long b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

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

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << '\n';
    }
    
    return 0;
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

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

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

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("%ld %ld\n", gcd, lcm);
  }

  return 0;
}

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

using namespace std;

typedef pair<int, int> P;

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

	return gcd(b, a % b);
}

P lcm(int a, int b) {
	int g = gcd(a, b);

	return P(g, a / g * b);
}

int main() {
	char s[1000];
	while (1) {
		string str;
		if ( !getline(cin, str) ) break;

		for (int i = 0; i < str.size(); ++i)
			s[i] = str[i];
		s[str.size()] = '\0';

		int a, b;
		sscanf(s, "%d%d", &a, &b);

		P p = lcm(a, b);

		cout << p.first << " " << p.second << endl;
	}
}

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

using namespace std;

unsigned long long gcd( unsigned long long a, unsigned long long b)
{
	if( b == 0 ) return a;
	else return gcd( b, a % b );
}
int main(int argc, char const* argv[])
{
	unsigned long long a,b,c;

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<2;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>

auto gcd (unsigned a , unsigned b) -> unsigned
{
    return b ? gcd (b , a % b) : a;
}

auto lcm (unsigned a , unsigned b) -> unsigned
{
    return a / gcd (a , b) * b;
}

auto main () -> int
{
    unsigned int a , b;
    while (std::cin >> a >> b)
    {
        std::cout << gcd (a , b) << ' ' << lcm (a , b) << std::endl;
    }
}

C++: #include<stdio.h>
int main(){
  unsigned long long a,b,m,ca,cb;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    ca = a;
    cb = b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    ca /= b;
    printf("%d %d\n",b,ca*cb);
  }
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
   
   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;

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

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


unsigned long long int GCM(unsigned long long int a,unsigned long long int b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	unsigned long long int a,b,L,G;
	
	cin>>a;
	do{
	cin>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(cin>>a);
	cin>>a;
}

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

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

int main(){
	
	while(true){
		int a,b;
		cin >> a >> b;
		
		if(cin.eof()) break;
		
		int g = gcd(a,b);
		cout << g << ' ' << a/g*b << endl;
		
	}
	
	return 0;
	
}

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

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

	return gcd(b,a%b);
}

int main(){
	while(true){
		int a,b;
		cin >> a>> b;
		
		if(cin.eof())
			break;

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