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>
using namespace std;

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

int lcm(int a,int b)
{
	return (a*b) / gcm(a,b);
}

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 && cin >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}

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

//最大公約数
int gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
int lcm(int a, int b)
{
    return (a * b / gcd(a,b));
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or b <= 0){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << lcm(a,b);
    }
}

return 0;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int a, b;
	while (cin >> a >> b){
		int i, GCD, LCM;
		if (a > b) {
			swap(a, b);
		}
		for (i = 1; i <= a && i <= b / 2; i++) {
			GCD = GCDr(a, b, i, GCD);
		}
		GCDr(a, b, i, GCD);
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int GCD,LCM,a,b,xb,xa;
	while(cin>>a>>b){
		if(a=0 || b== 0){continue;}
		xa=a;
		xb=b;
		while(1){
			if(xa>xb){
			xa = xa%xb; 
			}
			else if(xa<xb){
			xb = xb%xa;
			}
			if(xb==xa){break;
			}
		}
		GCD=xb;
		LCM=(a*b)/xb;
		cout<<GCD<<" ";
		cout<<LCM<<endl;
		
	}

	return 0;

}

C++: ~/5416061-aoj-0005.rb

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<set>
#include<iomanip>
using namespace std;
using ll=long long int;

ll gcd(ll p, ll q) {
	ll r = p % q;
	while (r != 0) {
		p = q;
		q = r;
		r = p % q;
	}
	return q;
}

ll lcm(ll p, ll q) {
	return p * q / gcd(p, q);
}

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 a, b, c, d,r,s,h;
	while (cin >> a >> b){
		//c
		h = a;
		s = b; {
			r = h % s;
			if (r == 0) {
				c = s;
				break;
			}
			h = s;
			s = r;
		}

		//d
		h = a;
		s = b;
		if (a < b){
			for (;;){
				if ((b % a) == 0){
					d = b;
					break;
				}
				b = b + s;
			}
		}
		else if (a >= b){
			for (;;){
				if ((a % b) == 0){
					d = a;
					break;
				}
				a = a + h;
			}
		}

		cout << c << ' ' << d << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
#define EPS 1e-10
using namespace std;
int gcd(int a,int b){
  if(b == 0)return a;
  return gcd(b,a%b);
}
int lcm(int a,int b){
  return (a/gcd(a,b))*b;
}
int main(){
  int a,b;
  while(cin >> a >> b){
    if(a < b)swap(a,b);
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;

  }
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int rez(int a, int b)
{


}


int main()
{



}

C++: #include<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(int, int);

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		int tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

int yukurid(int a, int b)
{
	int tmp;
	if (a%b == 0)return b;
	else
	{
		tmp = a;
		a = b;
		b = tmp%b;
		return yukurid(a, b);
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    long long a,b,c,d,e;
    cin>>a>>b;
    for(long long i=1;i<2000000000;i++){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    e=a*b/c;
    cout<<c<<" "<<e<<endl;
    return 0;
}

C++: #include<iostream>

using namespace std;

int a, b;
int change;
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;
}
int main()
{
	while(cin>>a>>b)
	{
		printf("%d %d\n",GCD(a,b),LCM(a,b));
	}
}

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    cin >> x >> y;

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

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

    return 0;
}

C++: #include<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

int GCD(long long int n,long long int m){
    if(n%m==0){
        return m;
    }
    return GCD(m,n%m);
}

int main(){
    scanf("%lld%lld",&n,&m);
    if(n<=m){
        ans1=GCD(m,n);
    }
    else{
        ans1=GCD(n,m);
    }
    ans2=m*n/ans1;
    printf("%lld %lld\n",ans1,ans2);
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


V<string> split(const string& s, char c) {
  V<string> res;
  stringstream ss(s);
  string t;
  while (getline(ss, t, c)) res.push_back(t);
  return res;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  string s;
  while (getline(cin, s)) {
    auto ss = split(s, ' ');
    lint a = stoll(ss[0]), b = stoll(ss[1]);
    lint g = __gcd(a, b);
    lint l = a * b / g;
    cout << g << ' ' << l << '\n';
  }
}