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>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int main(void){
  int i,j,k,l,m=1,a,b,c[10],d[10],e;
  scanf("%d %d",&a,&b);
  if(a<b){
    k = b;
    b = a;
    a = k;
  }
  j = k = 0;
  for(i=2;i<a;i++){
    if(!(a%i)){
      c[j] = i;
      j += 1;
    }
  }
  for(i=2;i<b;i++){
    if(!(b%i)){
      d[k] = i;
      k += 1;
    }
  }

  for(i=j-1;i+1;i--){
    for(l=k-1;l+1;l--){
       if(c[i] == d[l]){
	printf("%d ",c[i]);
	m = 0;
	e = c[i];
	break;
      }
    }
    if(!m)
      break;
  }
  printf("%d",a*b/e);
  return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define swap(a,b) tmp=a, a=b, b=tmp
int main(){
	long long int a, b, ai, bi, tmp;
	while(cin >>ai>>bi){
		a=ai, b=bi;
		if(a<b) swap(a,b);
		while(true){
			if(a%b==0) break;
			a%=b;
			swap(a,b);
		}
		cout << b << " " << ai*bi/b << endl;
	}
		

    return 0;
}

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

void AOJ0005()
{
	long a, b;
	while (cin >> a)
	{
		cin >> b;
		long c = max(a,b);
		long d = min(a,b);
		while (c != d)
		{
			long e = c - d;
			c = max(d, e);
			d = min(d, e);
		}
		long f = a/c * b;
		cout << c << " " << f <<endl;
	}
}

int main()
{
	AOJ0005();
	return 0;
}

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

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if(a == 0) {
			cout << 0 << " " << 0 << endl;
			break;
			}
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
		if(a != 0) { 
		cout << " " << c * d / min(a,b) << endl;
		}
	}

	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()
{
	ifstream ifs("Text.txt");
	unsigned long long int a,b,L,G;
	
	ifs>>a;
	do{
	ifs>>b;
	if(a!=0&&b!=0){
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}
	}while(ifs>>a);
}

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

int main()
{
	int a, b;

	while(cin >> a >> b)
	{
		int l;
	    int g = 1;

		for (int i = 2; a > i && b > i; i++)
		{
			for (int j = 0; a % i == 0 && b % i == 0; j++)
			{
				a = a / i;
				b = b / i;
				g *= i;
			}
		}

		l = g * a * b;
		cout << g << " " << l << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int gcd(int a,int b){
  
  return b>0 ? gcd(b,a%b):a;

}

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

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

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
    if( b > a )std::swap( a , b );
    unsigned long int LCM = a;
    GCD = b;
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<long long> num;
		long long k = 0;
		long long max = 1;
		for(long long i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(long long i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int gcd(unsigned int M,unsigned int N)
{
    if(M%N==0)return N;
    return gcd(N,M%N);
}
int main()
{
    unsigned int M,N,t;
    while(scanf("%u%u",&M,&N)!=EOF)
    {
        t=gcd(M,N);
        printf("%u %u\n",t,M*N/t);
    }
    return 0;
}

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

typedef unsigned long long L;
int main(){
	for(L a,b,c,d,e; cin>>a>>b;){
		for(c=a,d=b;;){
			e = c % d;
			c = d;
			d = e;
			if(!e)break;
		}
		cout<<c<<" "<<a*b/c<<endl;
	}
}

C++: #include<iostream>

using namespace std;

int gcd(int,int);
int lcm(int,int);

main(){

  int a, b;

  
  while(cin >> a >> b){

    cout << gcd(a,b) << " "<<lcm(a,b) << endl;

    

  }

}


int gcd( int m, int n )
{
	// [NbhÌû@
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd


// Å¬ö{iLeast Common MultiplejðÔ·B// øÉOª éêÍOðÔ·B

int lcm( int m, int n )
{	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f;
    cin>>a>>b;
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    
    return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=1;i<min(a, b);i++){
    if(a%i==0 && b%i==0){
      max = i;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
        cout << find_GCD(a, b) << " " << find_LCM(a, b) << endl;
  }

}

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

using namespace std; 

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << ' ' << a/g*b << endl;
  }

  return 0;
}

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

using namespace std;

void solve(int a, int b) {
	int min_num = min(a,b);
	int gcj = 0;
	for (int i=min_num; i>0; i--) {
		if (a%i==0 && b%i==0)
			gcj = max(gcj, i);
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int main(){

  int a,b;
  int yaku,bai;
  while(cin >> a >> b){
    for(yaku=a;1<yaku;yaku--)
      if(a%yaku==0 && b%yaku==0)
	break;

    for(bai=2;bai<=a;bai++)
      if((bai*b)%a==0){
	bai *= b;
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}