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<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	
	else 
	while(true){
		if(a==0||b==0)cout<<"a#";
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(x!=y){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor_rt.hpp>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int Ngcd = boost::math::gcd(a, b);
		int Nlcm = boost::math::lcm(a, b);
		cout << Ngcd << " " << Nlcm << endl;
	}
	return 0;
}

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

int main() {
	int a,b,c;
	while(cin>>a>>b){
		int g=0,l=0;
		if(a<b){
			c=b;
			b=a;
			a=c;
		}
		while(1){
			int i=1;
			if((i*a)%b==0){
				g=i*a;
			}
			if(g==i*a) break;
			i=i+1;
		}
		while(1){
			int i=2;
			if(a%i==0){
				if(b%(a/i)==0){
					l=a/i;
				}
			}
			i=i+1;
			if(l!=0) break;
		}
		cout<<g<<l<<endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

#define max( x, y ) ( ( x > y ) ? x : y )
#define min( x, y ) ( ( x < y ) ? x : y )

int main()
{
	char buf[1024];
	int a, b;

	while ( fgets( buf, sizeof( buf ) - 1, stdin ) != NULL && buf[0] != '\n' )
	{
		sscanf( buf, "%d %d", &a, &b );

		for ( int i = min( a, b ); 1 < i; i-- )
		{
			if ( !( a % i ) && !( b % i ) )
			{
				printf("%d ", i );
				break;
			}
		}

		for ( int i = max( a, b ); i <= 2000000000; i++ )
		{
			if ( !( i % a ) && !( i % b ) )
			{
				printf("%d\n", i );
				break;
			}
		}
	}

	return 0;
}

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

int main()
{
	for (unsigned long a, b, x, r; cin >> a >> b; cout << x << ' ' << a << endl) {
		unsigned long at = a, bt = b;
		do {
			r = a%b;
			a = b;
			b = r;
		} while (r);
		x = at*bt / a;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>

#define PI 3.14159265359

#define INF 1000000;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


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


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

C++: #include <stdio.h>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include <iostream>
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) {
    if ( ( 0 == a ) || ( 0 == b ) )
         return 0;
    return ((a / gcd(a, b)) * b);
}

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

C++: #include "bits/stdc++.h"
using namespace std;
int main(){
    long long x, y, st;
    while(cin >> x >> y){
        if(x >= y){
            st = gcd(x, y);
            cout << st << " ";
        }else{
            st = gcd(y, x);
            cout << st << " ";
        }
        cout << x * y / st << endl;
    }
    return 0;
}
long long gcd(long long a, long long b){
    int r;
    while(b > 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		long long g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0) break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

C++: #include<bits/stdc++.h>

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
using namespace std;

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

    lcm=a*b;

    while(b!=0){
    gcd=a%b;
    a=b;
    b=gcd;
    }

    cout<<a space lcm/a <<endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

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

int main(){
  int a,b,ky,kb,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


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

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

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