Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    cout << endl;
    }

}