Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

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

C++: // -*- coding:utf-8; tab-width:4 -*-
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

// 解答
namespace solution {
    using namespace std;
   
    typedef istringstream ISS;
    typedef ostringstream OSS;
    typedef vector<string> VS;
    typedef long long LL;
    typedef int INT;
    typedef vector<INT> VI;
    typedef vector<VI> VVI;
    typedef pair<INT, INT> II;

    LL a, b;

    template <class T> T gcd( T a, T b ) {
        T i, j;
        for ( i = 0; ! ( a & 1 ); ++ i )
            a >>= 1;
        for ( j = 0; ! ( b & 1 ); ++ j )
            b >>= 1;
        while ( b != a ) {
            b -= a;
            if ( b < 0 ) {
                a += b;
                b = -b;
            }
            while ( ! ( b & 1 ) )
                b >>= 1;
        }
        return a << min( i, j );
    }

    template <class T> T lcm( T a, T b ) {
        T larger = a > b ? a : b;
        T smaller = a > b ? b : a;
        T res = larger;
        while ( res % smaller != 0 )
            res += larger;
        return res;
    }

    struct Solution {
        void init() {
        }
   
        bool input() {
            return cin >> a >> b;
        }

        void solve() {
            cout << gcd(a,b) << " " << lcm(a,b) << endl;
        }
      
        int run() {
            while ( init(), input() ) {
                solve();
            }
            return 0;
        }
    };
}

int main() {
    return solution::Solution().run();
}

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

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

int main()
{
  int a,b;
  int g;
  long int l;
  while(cin >> a >> b){
  
    if(a>b) g=gcd(a,b);
    else if(a<b) g=gcd(b,a);
    else g=a;

    l=a*b/g;
    cout << g << " " << l << endl;
  }

  return 0;
}

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

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); // lcm = m * n / gcd(m,n)
}

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

C++: //GCD and LCM
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

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

ll lcm(ll x, ll y){
  ll g=gcd(x, y);
  return (x/g)*y;
}

int main(){
  ll a, b;
  while(scanf("%lld %lld", &a, &b)!=EOF){
    if(a<b) swap(a, b);
    printf("%lld %lld\n", gcd(a, b), lcm(a, b));
  }
  return 0;
}

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

int x,y,n,a,b;

while(cin>>x>>y)
{
 a=x;
 b=y;
 if(x>y)
 {
 while(x%y!=0)
  {
   n=x%y;
   x=y;
   y=n;
   cout<<y<<" "<<a*b/y<<endl;
  }
 }
  else
  {
  while(y%x!=0)
  {
   n=y%x;
   y=x;
   x=n;
   cout<<x<<" "<<a*b/x<<endl;
  }
 }
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long int gcd(long int,long int);
long int lcm(long int,long int);
long int tes(long int,long int);

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

long int gcd(long int a,long int b){
  long int n;
  n=min(a,b);
  for(long int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}

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

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

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

int64_t gcd( int64_t x, int64_t y ) {
	return y ? gcd( y, x % y ) : x;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int a, b;
	while( (cin >> a) && (cin >> b) ) {
		cout << gcd( a, b ) << ' ' << lcm( a, b ) << '\n';
	}
}

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

int 
gcd ( int a, int b )
{
  int c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}

int lcm(int a, int b)
{
    int temp = gcd(a, b);

    return temp ? (a / temp * b) : 0;
}

int main()
{
    int a,b;
    while(cin>>a>>b) {
		printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    return 0;
}

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

int euclid(int b, int c){
	int a;
	while (c != 0){
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}

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

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int a, b;
	while (cin >> a&&cin >> b) {
		int min, max;
		int ans1, ans2;
		if (a > b) {
			min = b;max = a;
		}
		else {
			min = a;max = b;
		}
		for (int i = min;i >= 1;i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				ans1 = i;
				break;
			}
		}
		for (int i = max;;i++)
		{
			if (i%a == 0 && i%b == 0)
			{
				ans2 = i;
				break;
			}
		}
		cout << ans1 << " " << ans2 << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void){
	long a=0, b=0;
	long x=0;
	long m=0, n=0;
	while(scanf("%d %d", &a, &b) != EOF){
		if(a<b){
			x=b;b=a;a=x;
		}
		m=a;n=b;
		while(n != 0){
			x = n;
			n = m % n;
			m = x;
		}
		printf("%d %d\n", m, a/m*b);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

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

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

C++: #include<iostream>

int gcd(int a, int b){
  int k;
  if(b>a){
    k=b;
    b=a;
    a=k;
  }
  k = a % b;
  if(k==0){
    return b;
  }
  while(k!=0){
    k = a % b;
    a = b;
    b = k;
  }
  return a;
}

int main(){
  int a, b, k;

  while(std::cin >> a >> b){
    k = (a*b)/gcd(a,b);
    std::cout << gcd(a,b) << " " << k << std::endl;
  }
}