Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
				break;
	}
}


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

C++: #include <iostream>

using namespace std;

int gcd(int a, int b) {
    if (a < b) {
        swap(a, b);
    }
    int mod;
    mod = a % b;
    if (!mod) {
        return b;
    }
    return gcd(b, mod);
}

int lcm(int a, 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;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <stdio.h>
#define D(fmt,...) fprintf(stderr, fmt, ##__VA_ARGS__)
#define P(fmt,...) fprintf(stdout, fmt, ##__VA_ARGS__)

int gcd (int a, int b) {
  int min = a < b ? a : b;
  int gcd  = 1;
  int i = 0;
  for (i = 1; i < min; i++) {
    if (a % i == 0 && b % i == 0) {
      a /= i;
      b /= i;
      gcd *= i;
    }
  }
  return gcd;
}

int lcm (int a, int b, int g) {
  int lcm = 0;
  int min = a < b ? a : b;
  int x = a / g;
  int y = b / g;
  return g * x * y;
}
		      
int main (int ac, char **av)
{
  while(feof(stdin) == 0) {
    int a, b = 0;
    fscanf(stdin, "%d %d\n", &a, &b);
    int g = gcd(a, b);
    P("%d %d\n", g, lcm(a, b, g));
  }
  return 0;
}

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

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

int main(void){
   int a, b, tmp;
   if (a < b){
    tmp = b;
	b = a;
	a = tmp;

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

C++: #include <cstdio>
#include <cmath>
#define ele long
using namespace std;
ele a,b;
ele gcd(ele a,ele b){
	if (b==0) return a;
	return gcd(b,a%b);
}
inline ele lcm(ele a,ele b){ return a/gcd(a,b)*b; }
int main(){
	while (~scanf("%d%d",&a,&b)) printf("%d %d\n",gcd(a,b),lcm(a,b));
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	unsigned long long a,b,c,d;

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


return 0;
}

C++: import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    c = a * b
    while b:
        a, b = b, a % b
    print(str(a) + ' ' + str(c / a))

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a / B) * b;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }

 }
 return 0; 
}

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

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

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

C++: /* 2012-07-08T09:04:13 */
#define DEBUG_ON
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/time.h>
#include <vector>

#define INF (1e9)
static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

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();}
inline double now(){ struct timeval tv; gettimeofday(&tv, NULL); return ((double)(tv.tv_sec) + (double)(tv.tv_usec) * 1e-6); }

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define IFC(c) if(c) continue;
#define IFB(c) if(c) break;
#define IFR(c, r) if(c) return r;

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(c,it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

ll lcm(ll a, ll b)
{
	if (a < b) {
		swap(a, b);
	}
	ll am = a, bm = b;
	while (true) {
		bm += b;
		if (am == bm) {
			return am;
		}
		if (bm > am) {
			swap(a, b);
			swap(am, bm);
		}
	}
}

ll gcd(ll a, ll b)
{
	if (a < b) {
		swap(a, b);
	}
	while (true) {
		if (a % b == 0) {
			return b;
		}
		ll buf = a;
		a = b;
		b = buf % b;
	}
}

int main(int argc, char const* argv[])
{
	ll a, b;
	cin >> a >> b;
	cout << gcd(a, b) << " " << lcm(a, b) << endl;
	return 0;
}