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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",lcm, gcd);
    //std::cout << lcm << " " << gcd << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=1,m=1;
	if(a<b)swap(a,b);
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		
		if(b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		if(m==0)m=1;
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;
 
const int MAX_N=10000;
unsigned long long int a,b;

unsigned long long gcd(unsigned long long a,unsigned long long b){
	if(b) return gcd(b,a%b);
	else return a;
}

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

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

C++: #include<stdio.h>

int main(void)
{
	int a,b,c,d,z , *q;
	
	scanf("%d%d",&a,&b);
	c = 1;
	d = 1;
	while(1){
		if( a * c < b * d){
			c++;
		}else if( a * c > b * d){
			d++;
		}else if(a * c == b * d){
				*q = a*c;
			break;
		}
	}
	
	while(a % b != 0){
				z = a % b;
				a = b;
				b = z;
	}
	printf("%d %d",b,*q);
}

C++: #include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
#define MAXM 20006
#define MAXN 1006
#define INF 2100000000
using namespace std;
int n,m;
int gcd(int x,int y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
int main()
{
    while(scanf("%d",&n)==1)
    {
        scanf("%d",&m);
        int g=gcd(n,m);
        printf("%d %d\n",g,(n/g)*m);
    }
}

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

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

C++: 
#include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
   if(b!=0)return GCDi(b,a%b);
    return a;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){        int q[100],r[100],p = 0;

    while(~scanf("%d%d",&n,&m)){
        if(n > m){q[p] = GCDi(n,m);r[p] =LCMi(n,m);}
        else {q[p] = GCDi(m,n) ;r[p] =LCMi(m,n);}
        p++;
    }
    for(int i = 0;i < p;i ++) cout<<q[i]<<" "<<r[i]<<endl;
        return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(m!=n){
		if(m>n){
			m = m-n;
		}
		else{
			m = n-m;
		}
	}
	return m;
}
long long int lcm(long long int m,long long int n){
	if(m==0||n==0){
		return 0;		
	}
	else{
		return ((m/gcd(m,n))*n);
	}
}

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>using namespace std;
int gcd(int a, int b)

if(a < b) {
  return gcd(b, a);
}

    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<iostream>

using namespace std;

long long int a,b;

int main(void)
{
	while(cin>>a>>b){
		long long int x,y;
		x=1;
		for(int i=2;i<=a&&i<=b;){
			if(a%i==0&&b%i==0){
				x=x*i;
				a=a/i;
				b=b/i;
				i=2;
			}else{ i++; }
		}
		y=x*a*b;
		cout<<x<<" "<<y<<endl;
	}
}

C++: #include <stdio.h>

long GetGCD(long x, long y);

int main(void){
    long  n,m,gcd,lcm;
    
    while (scanf("%ld %ld", &n, &m)!=EOF){
        gcd = GetGCD(n,m);
        lcm = n * m / gcd;
        printf("%ld %ld\n", gcd, lcm);
    }
    return 0;
}

long GetGCD(long x, long y){
    return y%x ? GetGCD(y%x, x) : x;
}

C++: #include<iostream>
using namespace std;
typedef long long int ll;

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

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


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

C++: #include <iostream>


using namespace std;

int main(){
	
	int ii = 1;
	int a;
	int b;
	while (1){
		
		cin >> a >> b;
	for (int i = 0; i <= 2000000001; i++){
		
		
		int c = ii / a * a;
		int d = ii / b * b;
		if (ii == c&&ii == d){
			cout << a * b / ii <<  " " <<ii<< endl;
			break;
		}
		else ii++;

}
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,aa,b,bb,c,s,ss;
	while(scanf("%d %d",&a,&b)!=EOF){
		aa=a;  
		bb=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		while(1)	{
			if(a%b==0)	{
				break;
			}
			else	{
				c=a%b;
				a=b;
				b=c;	
			}
		}
		s=b;
		ss=aa/b*bb;
		printf("%d %d\n",s,ss);
	}
	return 0;
}

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


int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , __gcd(a,b) , (a/__gcd(a,b))*b);
	}
	return 0;
}

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

int Func_gcd(int num1, int num2){
	int surplus;

	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
    int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = num1 / gcd * num2;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int gcd(long long a,long long b){
    int c;
    if(a%b==0)
        return b;
    else
        c=a%b;
    if(a>c)
        return gcd(a,c);
    else
        return gcd(c,a);
}
int main()
{
    long long m,n;
    long long x,y;
    while(scanf("%I64d%I64d",&x,&y),x!=EOF,y!=EOF){
        if(x>y)
        m=gcd(x,y);
        else
        m=gcd(y,x);
    n=x*(y/m);
    printf("%I64d %I64d\n",m,n);
}
    return 0;
}

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

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