Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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.Printf("%d %d\n", y, lcm/y)
	}
}

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

int gcd(unsigned int a , unsigned int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

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

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	while((scanf("%d%d",&a,&b))!=EOF) 
	{
		long long int c,x,y;
		x=a;
		y=b;
		c=a%b;
		while(c!=0)
		{
			a=b;
			b=c;
			c=a%b;
		}
		long long int k;
		k=(x*y)/b;
		cout<<b<<" "<<k<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	long long a,b,c,d;

	while(cin>>a>>b){
		c=a;
		d=b;
		while(1){
			if(c>d)c=c-d;
			cout<<c<<" "<<d<<endl;
			if(c<d)d=d-c;
			
			cout<<c<<" "<<d<<endl;
			if(c==d){
				cout<<c<<" "<<a*b/c<<endl;
				;break;}
		}}
		


return 0;
}

C++: #include<cstdio>
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        int d=gcd(a,b);
        int lc=a/d*b;
        printf("%d %d\n",d,lc);
    }
}

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

int main(void)
{
	unsigned int a, b, g, l;

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

	return 0;
}

int gcd( int a, int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long n=max(a,b);
	long ans=1;
	for(long i=1;i<=n/2;i++){
		if(a%i==0&&b%i==0)ans=i;
	}
	if(a%n==0&&b%n==0)ans=n;
	return

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

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

int main() {
	double a, b, c, d, i;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (a == b || fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}

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

using namespace std;

void solve(int a, int b) {
	int min_num = min(a,b);
	int gcj = 0;
	for (int i=min_num; i>0; i--) {
		if (a%i==0 && b%i==0) {
			gcj = i;
			break;
		}
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

C++: #pragma GCC optimize "O3"
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define REP_FROM(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define REP_REV(i,n) for (int i = (n)-1; (i) >= 0; --(i))
#define REP_FROMREV(i,m,n) for (int i = (n)-1; (i) >= int(m); --(i))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#ifndef LOCAL
#define cerr if (false) cerr
#endif
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }
template <class T> inline void setmin(T & a, T const & b) { a = min(a, b); }
template <class T> T sq(T x) { return x * x; }
template <class T> T clamp(T a, T l, T r) { return min(max(a, l), r); } // [l, r]
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(LL m, LL n){
	while(m!=n){
		if(m>n)
			m=m-n;
		else
			n=n-m;
	}
	return m;
}
int lcm(LL m,LL n)
{
	return m*n/gcd(m,n);
}

int main(int argc, char *argv[]) {
	// Something to do
	int a, b;
	while(cin >> a >> b) {
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
constexpr int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
 
constexpr int lcm(const int &a, const int &b) {
  return a * b / gcd(a, b);
}
 
int main() {
  int a, b;
  while (cin >> a >> b) cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}

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

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

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

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

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

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

int main() {
	int a, b,i;
		while (cin >> a >> b) {
			if (a > b)
				i = b;
			else
				i = a;
			for (; i > 0; i--) {
				if (b%i == 0 && a%i == 0) {
					cout << i << " ";
					break;
				}
				//if (i == 0)
					//cout << 1 << " ";
			}
			if (a > b)
				i = a;
			else
				i = b;
			if (a > b) {
				for (i = a; i%b; i += a);
				cout << i << endl;
			}
			else {
				for (i = b; i%a; i += b);
				cout << i << endl;
			}
		}
	return 0;
}

C++: int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<5;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <cstdio>
	int m, n;
int GCD(int m, int n)
{
    while( 1 )
    {
        m = m % n;
		if( m == 0 )
			return n;
		n = n % m;

        if( n == 0 )
			return m;
    }
}
int LCM( int m, int n )
{
		
	return ((m / GCD(m, n)) * n); // lcm = m * n / gcd(m,n)
}
int main()
{
	while(scanf("%d%d",&m,&n)!=EOF)
	{

		printf("%d %d",GCD(m,n),LCM(m,n));
	}
	return 0;
}