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

using namespace std;

int main()
{
	long a, b, r, c, d;
	long ta, tb;

	scanf("%d %d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	d = b * (a  / c);

	printf("%d %d\n", c, d);

	return (0);
}

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

using namespace std;

int main() {
	long a, b;
	while (cin >> a >> b) {

		cout << __gcd(a, b) << " " << a * b / gcd(a, b) << endl;
	}

}

C++: #include <cstdio>
#define ll long long
ll gcb(ll a, ll b) {
    return a ? gcb(b % a, a) : b;
}
ll a, b;
int main() {
    while (~scanf("%lld %lld", &a, &b)) {
        if (a > b) {
            ll t = a;
            a = b;
            b = t;
        }
        ll g = gcb(a, b);
        printf("%lld %lld\n", g, a * b / g);
    }
    return 0;
}

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

int gcd(int x,int y);
int lcm(int x,int y);

int main(){
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      cout << gcd(a,b) <<" "<<lcm(a,b)<<endl;
    }
  return 0;
}

int gcd(int x,int y){
  int z;
  while(y != 0){
  z = x%y; 
  x = y;
  y = z;
  }
  return x;
}

int lcm(int x,int y){

  return x/gcd(x,y)*y;

}

C++: #include <iostream>
using namespace std;
int main(void){
    long long int a, b;
    while(cin >> a >> b){
        long long int tmp;
        if(a < b){
            tmp = a;
            a = b;
            b = tmp;
        }

        long long int m = a * b;
        //ユークリッドの互除法を用いて最大公約数を求める
        long long int r = a % b;
        while(r != 0){
            a = b;
            b = r;
            r = a % b;
        }
        long long int gcd = b;

        //続いて、公式を用いて最小公倍数を求める
        long long int lcm = m / gcd;

        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <iostream>

using namespace std;

int gcd(int x, int y) {
	int r;
	if(x == 0 || y == 0) {
		return 0;
	}

	while(x % y != 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

long long int lcm(int x, int y) {
	if(x == 0 || y == 0) {
		return 0;
	}
	return ((x / gcd(x, y)) * y );
}

int main() {
	int x, y;

	while(cin >> x >> y) {
		if(x > y) {
			cout << gcd(x, y) << " " << lcm(x, y) << endl;
		}
		else {
			cout << gcd(y, x) << " " << lcm(y, x) << endl;
		}
	}
}

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

int main(){
		long long a, b, gcd, lcm;
		while(cin >> a >> b){
				vector<long long> divisor_a;
				vector<long long> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				lcm = a / gcd * b;
				cout << gcd << " " << lcm << endl;
		}
		return 0;
}

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

int lcm(int max, int min) {
    int multiplier = 1;
    while ((max * multiplier) % min != 0) {
        multiplier++;
    }
    return max * multiplier;
}

int gcd(int max, int min) {
    int r = max % min;
    int x = min;
    while (r != 0) {
        int tmp = r;
        r = x % r;
        x = tmp;
    }
    return x;
}

int main(void) {
    int a, b;
    while (scanf("%d %d", &a, &b)+1)  {
        int min = (a < b)? a : b;
        int max = (a < b)? b : a;
        printf("%d %d\n", gcd(max, min), lcm(max, min));
    }
    return 0;
}

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

int main() {
	long long int a, b, t, aa, bb;

	while (!cin.eof()) {
		cin>>a;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int i;
		if(a>=b)
			i=b;
		else
			i=a;
		while(true){
			if(a%i==0&&b%i==0)
				break;
			i--;
		}
		int keep=i;
		cout<<i<<" ";
		if(a>=b)
			i=a;
		else
			i=b;
		while(true){
			if(i%a==0&&i%b==0)
				break;
			i+=keep;
		}
		cout<<i<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<ctime>
#define RG register
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
using namespace std;

#define ll long long 
int main(){
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld ",__gcd(a,b));
		printf("%lld\n",1ll*a*b/__gcd(a,b));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t, c;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		s = *a;
		t = *b;
		c = 1;
		for(int tmp = (*a > *b)? *b : *a, i = 2; i <= tmp; i++){
			while(s%i == 0 && t%i == 0){
				s /= i;
				t /= i;
				tmp /= i;
				c *= i;
			}
		}
		cout << c << " " << ((*a)/c*(*b)) << endl;
	}
	
	return 0;
}

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

int main(){
	long long a, b, c;
	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;
typedef long long ll;
int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a % b);
}
int main(){
    ios::sync_with_stdio(false);
    int a, b;
    while(cin >> a >> b)
        cout << gcd(a, b) << " " << ll(a)*ll(b)/gcd(a, b) << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

pll gcdLcm(ll a, ll b) {
  ll x = a, y = b;
  if (x < y) swap(x, y);
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return pll(x, a*b/x);
}

int main() {
  ll a, b;
  while (scanf("%lld %lld", &a, &b) == 2) {
    pll r = gcdLcm(a, b);
    printf("%lld %lld\n", r.first, r.second);
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
int main(){
	long int a, b, product;

  	while (std::cin >> a >> b) {
    	product = a * b;
		std::vector<long int> v = {a, b};
    	while (v.at(0) != v.at(1)) { 
      		std::sort(v.begin(), v.end(), std::greater<long int>());
      		v.at(0) = v.at(0) - v.at(1);
		}	
    	std::cout << v.at(0) << " " << product/v.at(0) << std::endl;	
  	}
	return 0;
}

C++: #include <iostream>

#define LL long long

LL GCD(LL a, LL b) {
	LL
		c = a > b ? a : b,
		d = a < b ? a : b;
	while (c != d) {
		c -= d;

		LL tmp[] = {c, d};
		c = std::max(tmp[0], tmp[1]);
		d = std::min(tmp[0], tmp[1]);
	}

	return c;
}

LL LCM(LL a, LL b) {
	return a * b / GCD(a, b);
}

int main() {
	int a, b;
	while (std::cin >> a >> b) {
		std::cout << GCD(a, b) << " " << LCM(a, b) << std::endl;
	}
}

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