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 <algorithm>
using namespace std;

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			int s;
			s = a;
			a = b;
			b = s;
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>

using namespace std;

typedef unsigned long long ullong;

class cgl
{
public:
	ullong gcd(ullong, ullong);
	ullong lcm(ullong, ullong, ullong);
};

ullong cgl::gcd(ullong a, ullong b)
{
	if (a % b == 0)
		return b;
	return gcd(b, a % b);
}

ullong cgl::lcm(ullong a, ullong b, ullong g)
{
	return a * b / g;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cgl cg;
	ullong a, b, g;

	for (;;)
	{
		cin >> a >> b;
		if (fin.fail()) break;
		g = cg.gcd(a, b);
		cout << g << " " << cg.lcm(a, b, g) << endl;
	}

	return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <climits>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <deque>
#include <list>
#include <map>
#include <set>
using namespace std;

/*** typedef ***/
typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ULL;
typedef pair < int , int > ii;
typedef pair < LL  , LL  > ll;
typedef vector <int>  vint;
typedef vector <bool> vbool;
typedef vector <long> vlong;

/*** define ***/
#define sz(x)			((int)x.size())
#define tin(x)			scanf("%d",&x)
#define all(x)			x.begin(),x.end()
#define Set(b,a)		memset(b,a,sizeof b)
#define print1(x)		printf("Case %d:",x++)
#define tin2(x,y)		scanf("%d%d",&x,&y)
#define tin3(x,y,z)		scanf("%d%d%d",&x,&y,&z)
#define loop(i,i0,in)	for(int i=i0 ; i<in ; i++)
#define rep(i,n)		for(int i=0 ; i<(n) ; i++)
#define _rep(i,n)		for(int i=n-1 ; i>=0 ; i--)
#define _loop(i,in,i0)	for(int i=in-1 ; i>=i0 ; i--)
#define Fore(it, x)		for(typeof (x.begin()) it = x.begin(); it != x.end (); it++)

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

LL lcm(LL a,LL b)
{
	return a*b/gcd(a,b);
}
     
int main()  
{  
#ifdef Online_Judge
	freopen("a.in","r",stdin);
#endif
	LL a,b;
	while(scanf("%I64d %I64d",&a,&b)==2)
		printf("%I64d %I64d\n",gcd(a,b),lcm(a,b));
	return 0;
}

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

int main()

{
	unsigned int a,b;
	while(~scanf("%u%u",&a,&b)){
	    
		unsigned int c=a,d=b;
		while(a>0&&b>0){
			if(a>b)a=a%b;
			else b=b%a;
		}
		printf("%u %u\n",a+b,c/(a+b)*d);
		
	}
	
	return 0;
}

C++: #include <stdio.h>

int main(){
    float a[20],b[20];
    int nCount = 0;
    while( scanf( "%f %f",&a[nCount],&b[nCount] ) != EOF ){
        nCount++;
    }

    for( int k = 0;k < nCount;k++ ){
         float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
 
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

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

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

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

int main()
{
	unsigned long a, b;
	while (std::cin >> a >> b) {
		std::cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	long long int a, b, c=1, d=1, m, i;
	while (cin >> a >> b) {
		for (i = 0;i < b;i++) {
			for (m = 0;m < a;m++) {
				if (a*(i + 1) == b*(m + 1)) {
					c = a*(i + 1);
					i = -1;
					break;
				}
			}
			if (i == -1) { break; }
		}
		if(a > b){
			for (i = a;i > 0;i--) {
				if (a%i == 0 && b%i == 0) { break; }
			}
		}else{
			for (i = b;i > 0;i--) {
				if (b%i == 0 && a%i == 0) { break; }
			}
		}
		d = i;
		cout << d << ' ' << c << endl;
	} 
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

using namespace std;


    long long g(int a,int b){

	int r=max(a,b)%min(a,b);
	if(r==0)  return min(a,b);
	else return g(min(a,b),r);
}

int main(){

	long long a,b;
	cin >> a >> b;

	cout << g(a,b) << " " << (a*b)/g(a,b) << endl;


	return 0;
}

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!=0){    q=b/a;    r=b%a;    b=a;    a=r;    }    return b;}
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<cstdio>
#include<iostream>
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 (scanf("%d%d", &a, &b) != EOF){
		cout << gcd(a, b) << " ";
		cout << lcm(a, b) << endl;
	}
	//system("pause");
	return 0;
}

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

long long int num[1000][2];
int t;

void gcdlcm(int n, int m){
	long long int a, b;
	a = n;
	b = m;
	for(int i = 0; i < 1000; i++){
		if(n % m == 0){
			num[t][0] = m;
			num[t][1] = a*b/m;
			break;
		}
		else{
			n = n - (n/m)*m;
			swap(n, m);
		}
	}		
}
int main(){
	int a, b;
	t = 0;
	while(cin >> a >> b){
		gcdlcm(a, b);
		t++;
	}
	for(int i = 0; i < t; i++){
		cout << num[i][0] << " " << num[i][1] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
    int a,b,lcm=0,count=0;
    while(cin>>a>>b){
        count++;
        if(count>50)break;
    for(int k=a;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    cout<<lcm<<" "<<a*b/lcm<<endl;
}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
ll a , b;
while(cin >> a >> b)
cout << __gcd(a , b) << " " << a*b/__gcd(a , b) << endl;
return 0;
}