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>
#include <cmath>

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b);i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

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

int main(){
  long long 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;
    //    long long int GCD = find_GCD(a, b);
    //    long long int LCM = a*b/GCD;

    long long int GCD;
    long long int LCM;
    LCM = find_LCM(a, b);
    GCD = a*b/LCM;
    cout << GCD << " " << LCM << endl;
  }

}

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

ll gcd(ll p, ll q){
    if(q==0) return p;
    else return gcd(q, p%q);
}

ll lcm(ll p, ll q){
    ll g = gcd(p, q);
    return p/g*q;
}

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

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
	exit(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{
 int x,y,n,a,b;
 while(cin>>x>>y)
 {
  a=x;
  b=y;
  while(x%y!=0)
  {
   n=x%y;
   x=y;
   y=n;
  }
 cout<<y<<" "<<a*b/y;
 }
return 0;
}

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

C++: #include <stdio.h>
int main(void){
    int a,b,d,n,m;
    while(~scanf("%d%d",&a,&b)){
        n=a,m=b;
        while(b>0)d=a%b,a=b,b=d;
        printf("%d %d\n",a,n/a*m);
    }
    return 0;
}

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<iostream>
using namespace std;
int gcd(int a, int b){
	int t;
	if(a < b){t=a;a=b;b=t;}
	t = b;
	b = a % b;
	a = t;
	if(b == 0){
		return a;
	}else{
		gcd(a,b);
	}
}
int lcm(double a, double b){
	return (a * b) / (gcd(a,b));
}
int main(){
	int a,b;
	while(cin >> a >> b)
	cout << gcd(a,b) << ' ' << lcm(a,b) << '\n';
	return 0;
}

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

void GetGCD(int a, int b, int& GCD)
{
	if(a == 0){
		GCD = b;
		return;
	}
	if(b == 0){
		GCD = a;
		return;
	}
	if(a >= b){
		a = a % b;
	}else{
		b = b % a;
	}
	GetGCD(a, b, GCD);
}

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

C++: #include <cstdio>

//input
int a, b;

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

void solve(){
	printf("%d %d\n", gcd(a, b), lcm(a, b));
}

int main(int argc, char const *argv[]){

	while(scanf("%d %d", &a, &b) != EOF){
		solve();
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
    int a,b,fl;
    while(cin>>a>>b)
    {
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if(a%i==0&&b%(a/i)==0)
            {
                cout<<a/i<<" ";
                fl++;
            }
            else;
        }
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if((a*i)%b==0)
            {
                cout<<a*i<<endl;
                fl++;
            }
            else;
        }
    }
    return 0;
}

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

using namespace std;

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

int main(void){
    int a, b, tmp;
   
     if(a<b){
        tmp = a;
        a = b;
        b = tmp;
        }
     
     while(cin >> a >> b){
         int lcm = (a*b)/gcd(a,b);
         cout<<gcd(a,b)<<" "<<lcm<<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(1){
	int a,b;
	cin>>a>>b;

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

C++: #include <stdio.h>
int gcd(long long int x,long long int y)
{
    long long int tem;
    while(y!=0)
    {
        tem=y;
        y=x%y;
        x=tem;
    }
    return x;
}
int main()
{
    long long int a,b,x,y,l,g;
    while(scanf("%lld%lld",&a,&b)==2)
    {
        g=gcd(a,b);
        l=(a*b)/g;
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: /*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        long int temp_a = a;
        long int temp_b = b;
        while(1){
            long int l = max(temp_a,temp_b);
            long int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

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


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

int main()
{
	ifstream ifs("Text.txt");
	long long int a,b,L,G;
	
	
	ifs>>a;
	do{
	ifs>>b;
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}while(ifs>>a);
	cin>>a;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define int long long

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

unsigned main(){
    int A,B;
	while(cin>>A>>B){
		printf("%lld %lld\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

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


long long int gcd(long long int a,long long int b){
	long long int q;
	q=a%b;
	if(q==0)return b;
	a=b;
	b=q;
	return gcd(a,b);
}
int main(){
	long long int a,b,q,g;
	while(cin>>a&&cin>>b){
		if(b>a){
			q=a;
			a=b;
			b=q;
		}
		g=gcd(a,b);
		cout<<g<<" "<<a*b/g<<endl;
	}
	return 0;
}