Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory>

using namespace std;

#if 1
#define PRINT(x) { cout << #x << ": " << (x) << endl; }
#define PRINT_CONTAINER(x)  { cout << #x << ": ";                       \
        for (size_t ix = 0; ix < (x).size(); ++ix) cout << (x)[ix] << ", "; \
        cout << endl; }
#else
#define PRINT(x)
#define PRINT_CONTAINER(x)
#endif

typedef pair<int, int> p;

int a, b;

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

int main(int argc, char *argv[]) {
    while (scanf("%d %d", &a, &b) != EOF) {
        int g = gcd(a, b);
        printf("%d %d\n", g, (a / g) * b);
    }
    return 0;
}

C++: #include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int a,b;
    cin>>a>>b;
    if(a<b)swap(a,b);
    cout<<gcd(a,b)<<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}}
ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ull a,b;
        cin>>a>>b;
        if(a==0)return 0;
        ull r1=gcd(a,b);
        ull r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}

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

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

int gcd(int x,int y);

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

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

C++: #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

LL gcd(LL a, LL b) {
	if (b > 0) {
		return gcd(b, a % b);
	} else {
		return a;
	}
}

LL lcm(LL a, LL b) {
	return ((a / gcd(a, b)) * b);
}

//================================================

int main() {
	LL A, B;

	while (cin >> A >> B) {
		cout << gcd(A, B) << " " << lcm(A, B) << "\n";
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	unsigned long long a, b;
	while (cin >> a >> b){
		unsigned long long gcd, lcm;
		unsigned long long c, d;
		c = max(a, b);
		d = min(a, b);
		while (true){
			if (c % d == 0) {
				break;
			}
			else{
				gcd = c%d;
				c = d;
				d = gcd;
			}
		}
		lcm = a*b / gcd;
		cout << gcd <<' '<< lcm << endl;
	}
}

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

int GCD(int a, int b)
{
    int asw = 1;
    int tmp;
    if (a > b) {
        while (b >= asw) {
            if (!(b % asw)) {
                tmp = b / asw;
                if (!(a % tmp))
                    break;
            }
            asw++;
        }
    } else {
        while (a >= asw) {
            if (!(a % asw)) {
                tmp = a / asw;
                if (!(b % tmp))
                    break;
            }
            asw++;
        }
    }
    return tmp;
}

int LCM(int a, int b)
{
    int asw;
    if (a < b) {
        asw = b;
        while (asw % a)
            asw += b;
    } else {
        asw = a;
        while (asw % b)
            asw += a;
    }
    return asw;
}

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

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

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}
main()
{
    long long n,k,j,max,min,x,y,t;
    while(~scanf("%lld %lld",&x,&y))
    {
        max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
    printf("%lld %lld\n",min,max);
    }

}

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 >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}