Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	while(cin)
	{
		lld a,b;
		cin >> a >> b;
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

C++: #include <cstdio>

unsigned long getGCD(unsigned long a, unsigned long b)
{
        if (!b) {
                return a;
        }

        return getGCD(b, a % b);
}

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b)) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                unsigned long gcd = getGCD(max, min);
                unsigned long lcm = a * b / gcd;
                printf("%lu %lu\n", gcd, lcm);
        }

        return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int a,b, s;
    while(scanf("%d%d", &a, &b)!=EOF){
        s=__gcd(a, b);
        printf("%d %d\n", s, (a/s)*b);              
                        
    }  
    return 0;
}

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

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

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

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

using namespace std;

int main(){

    long long int a,b;

    while(scanf("%lld%lld", &a, &b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a*b/__gcd(a,b));
    }

    return 0;
}

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

int main(){

	int a, b, j, tmp, gcd, lcm;
	
	while(cin >> a >> b){
	
		if(a > b){
			tmp = a;
			a = b;
			b = tmp;
		}
	
		gcd = a;
		for(int i=2;; i++){
			if(b % gcd == 0 || gcd == 1) break;
			else{
				for(j=i; a % j != 0; j++);
				gcd = a / j;
			}
		}
		
		lcm = b;
		for(int i=2;; i++){
			if(lcm % a == 0) break;
			else{
				lcm = b * i;
			}
		}
	
		cout << gcd << " " << lcm <<endl;
	
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

template <class T>
T gcd(T a, T b)
{
	if (b == 0)
		return a;
	return gcd(b, a%b);
}

int main()
{
	long a, b;
	while (scanf("%ld %ld", &a, &b) != EOF)
	{
		long g = gcd(a, b);
		long l = a/g * b;
		printf("%d %d\n", g, l);
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;

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

int main()
{
    long long int a = 0;
    long long int b = 0;
    long long int GCD = 0;
    long long int LCM = 0;
    
    while (cin >> a >> b)
    {
        if (a < b)
        {
            long long int tmp = a;
            a = b;
            b = tmp;
        }
        
        GCD = gcd(a, b);
        LCM = a / GCD * b;
        
        cout << GCD << " " << LCM << endl;
    }
    
    return 0;
}

C++: #include<bits/stdc++.h>
/*
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
*/
using namespace std;

typedef long long ll;

#define sqr(x) (x)*(x)
#define pb push_back
#define fst first
#define snd second

const ll mod=1000000007;
const int maxn=100005,maxm=505;
const double eps=1e-9;
const double pi=acos(-1.0);

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

ll a,b;

int main()
{
	int i,j,T;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		ll g=gcd(a,b);
		printf("%lld %lld\n",g,a/g*b);
	}
	return 0;
}

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

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a;
	cin >> b;
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << l << " " << g;

	
}

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",gcd, lcm);
    //std::cout << gcd << " " << lcm << 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;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

C++: #include <iostream>
using namespace std;
long long a1,a2;
long long gcd,lcm;

long long GCD(long long a,long long b){
    long long i = 2;
    long long minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
ll gcd( ll a, ll b ) {
  if ( b == 0 ) return a;
  return gcd( b, a % b );
}
 
int main() {
  ll a,b;
  while ( cin >> a >> b ) {
  ll ans = gcd(a,b);
  ll ans2 = a * b / ans;
  cout << ans << " " << ans2 << 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() {
  for(int a, b; cin >> a >> b; ) {
    int g = gcd(a,b);
    cout << g << " " << a / g * b << endl;
  }
}

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

int main(){
	int a,b,gcd,lcm;
	while(cin >> a >> b){
		int c=a,d=b;
		lcm=gcd=1;
		for(int i = 2; i < c || i < d;){
			if(c%i==0&&d%i==0){
				c/=i;
				d/=i;
				lcm=gcd*=i;
			}else i++;
		}
		lcm*=c*d;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}