Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <fstream>
#include <stdint.h>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

#define REP(i,f,n) for(int i=(f); i < (n); ++i)
#define PER(i,f,n) for(int i=(n-1); i >= f; --i)


//----------------------------------
//----------------------------------

int64_t gcd(int a, int b)
{
	return b == 0 ? a : gcd(b, a % b);
}

signed main()
{
    ios::sync_with_stdio(false);
	int64_t a, b;
	while(cin >> a)
	{
		cin >> b;
		int64_t gc = gcd(max(a,b),min(a,b));
		cout << gc << ' ' << a * b / gc << endl;
	}

}

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

int  gcd(int m, int n);
int lcm(int m,int n);

//?????§??¬?´???°??¨????°???¬?????°????±???????
int main()
{
	int a[50],b[50];
	int set = 0;
	while( cin >> a[set] >> b[set]){
		set++;
	}
	for(int i = 0;i < set; i++){
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	}

	return 0;
}

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

int lcm(int m,int n)
{
	if(0 == m || 0 == n)
		return 0;
	return ((m / gcd(m, n)) * n);
}

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

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

long long lcm(long long a, long long b) {
    assert(a > 0 && b > 0);
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
using namespace std;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

int gcd(int x,int y){
    if (y==0)return x;
    return gcd(MIN(x,y), MAX(x,y)%MIN(x,y));
}

int lcm(int x,int y){
    return x * y / gcd(x,y);
}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair



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

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

int main(void){
  long long int x,y,g,l,t;
  while(cin >> x >> y){
    if(x<y)
      swap(x,y);
    g=__gcd(x,y);
    l=x*y/g;
    cout << g << " " << l <<endl;
  }
  return 0;
}

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;

lld gcd(lld x,lld y)
{
	if (y == 0)
	{
		return x;
	}
	return gcd(y,x%y);
}

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << endl;
		cout << (n * m) / sol << endl;
	}


	return 0;
}

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

int main(){
	long long a,b;
	while(cin >> a >> b){
		vector<int> num;
		int k = 0;
		long long max = 1;
		for(int i = 2; i < a/2; i++){
			if(a % i == 0){
				num.push_back(i);
				k++;
			}
		}
		for(int i = 0; i < k; i++){
			if(b % num[i] == 0){
				max = num[i];
			}
		}
		long long min = (a * b) / max;
		cout << max << " " << min << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main( void )
{
	long a, b;
	while(cin >> a >> b) {
		long aa, bb, cc;
		aa = a; bb = b;
		while(bb) {
			cc = aa % bb;
			aa = bb;
			bb = cc;
		}
		cout << aa << ' ' << a*(b/aa) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c,d,e;
	std::cin>>a>>b;
	d=a;
	e=b;
	if(b>a){
		int d;
		d = a;
		a = b;
		b = d;
	}
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
std::cout<<a<<" "<<((e/a)*(d/a)*a);
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a * b / y) << endl;
	}

}

C++: #include <iostream>

using namespace std;

int main () {
    while (!cin.eof()) {
        int num1;
        int num2;
        cin >> num1 >> num2;
        int a = num1, b = num2;
        if (a<b) {
            a = num2;
            b = num1;
        }
        int q = a/b, r = a%b;
        while (r != 0) {
            a = b;
            b = r;
            q = a/b;
            r = a%b;
        }
        a = num1/b;
        cout << b << " " << a*num2 << endl;
        
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int getGCD(int a, int b)
{
	if (a > b)
	{
		swap(a, b);
	}
	return (a == 0) ? b : getGCD(a, b % a);
}

int main()
{
	int a, b;
	for (; cin >> a >> b;)
	{
		int gcd = getGCD(a, b);
		cout << gcd << " " << (a / gcd) * b << endl;
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
typedef unsigned long long ULL;

inline ULL GCD(ULL a,ULL b)
{
    ULL res=0;
    if(a != b)
    {
        if(a > b) 
        {
            if(a % b == 0)
            {
                return b;
            }
            else
            {
                GCD(b,(a % b));
            }

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

        }
    }
    else
    {
        return a;
    }
}
inline ULL LCM(ULL a,ULL b)
{
    ULL l  = GCD(a,b);
    ULL l1 = a / l;
    ULL l2 = b / l;
    return l * l1 * l2;
}
int main()
{
    ULL a,b;
    while(cin >> a >> b)
    {
        cout << GCD(a,b) << " " << LCM(a,b) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
#define DBG cout<<"!"<<endl;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    les=b%bet;
    if(les==0)
      max=bet;
    else{
    for(int i=1;i<=bet;i++){
      if(bet%i==0)
	ayaku.push_back(i);
    }
    for(int i=1;i<=les;i++){
      if(les%i==0)
	byaku.push_back(i);
    }
    for(int i=0;i<ayaku.size();i++){
      for(int j=0;j<byaku.size();j++){
	if(ayaku[i]==byaku[j]&&ayaku[i]>max)
	  max=ayaku[i];
      }
    }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}