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<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
//#include <vector>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
int main(){
	int a, b;
	while (cin>>a>>b){
		int c = gcd(a, b);
		cout << c << " " << a / c*b << endl;
	}
	return 0;
}

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

int main() {
    long long int a, b;
    while (cin >> a >> b) {
    cout << a * b /(a/__gcd(a,b)*b)<< " " <<a/__gcd(a,b)*b<< endl;
  }
}

C++: #include <iostream>
using namespace std;
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))

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

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

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 gcd(int a,int b){
    if(a>=b){
        if(b==0){return a;}
        else{
            return gcd(a%b,b);
        }
    }
    else{
        return gcd(b,a);
    }
}

int main(){
    int a,b;
    while(cin>>a>>b){
        int gcd_=gcd(a,b);
        long long lcm=a/gcd(a,b)*b;
        cout<<gcd_<<" "<<lcm<<"\n";
    }
}

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

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

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

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

C++: #include <cstdio>

unsigned gcd(unsigned a, unsigned b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  while (a % b != 0) {
    unsigned t = a;
    a = b;
    b = t % b;
  }
  return b;
}

int main() {
  unsigned a, b;
  while (true) {
    if (scanf("%d %d", &a, &b) != 2) { break; }
    unsigned d = gcd(a, b);
    unsigned m = a / d * b;
    printf("%d %d\n", d, m);
  }
  return 0;
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <ctime>
#include <string>
using namespace std;
typedef pair<int,int> P;
typedef unsigned long long ll;
ll gcd(ll x,ll y){
    ll ma=max(x,y),mi=min(x,y),ama=ma%mi;
    if(ama==0) return mi;
    else return gcd(mi,ama);
}
ll lcm(ll x,ll y){
    ll g=gcd(x,y);
    if(g==1) return x*y;
    return g*lcm(x/g,y/g);
}
int main(){
    
    for(int i=0;i<50;i++){
        ll a,b;
        cin>>a>>b;
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
    return 0;
};

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

int main(){

  long long int a,b,c,r,s;

  while(cin >> a >> b){

    s=a*b;

    while(b!=0){

      c=a/b;
      r=a%b;
      a=b;
      b=r;

    }

    cout << a << ' ' << s/a <<  endl;
  }

  return 0;
}

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

int main() {
	int a = 0;
	int b = 0;
	int tmp = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a < b) {
			tmp = b;
			b = a;
			a = tmp;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= a_bk; c++) {
			while (a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;

			}
		}
		cout << d << '\n';
		d = a_bk * b_bk / d;
		cout << d << "\n";

	}
	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(b==0)
      return x;
   return gcd(b,a%b);
}

C++: // g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

ll a,b;

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

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

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

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

using namespace std;

int gcd(int a,int b)
{
    if(b == 0 || a == b)
        return a;
    else
        return gcd(b,a%b);
}
int lcm(int a, int b)
{
    int g = gcd(a,b);
    return (a / g) * b;
}

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

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


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(cin >> a >> b)
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b));
}

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

int gcd( unsigned int, unsigned int );
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( unsigned int a, unsigned 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>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		u_int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; i++){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << minmul << std::endl;

	}

	return 0;
}

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

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

int main(){
	long long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g) << endl;
	}
	return 0;
}

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

void compare(long int* a, long int* b){
  long int tem;
  if(*a < *b){
    tem = *a;
    *a = *b;
    *b = tem;
  }
}


int main(){
  long int a, b, k;
  long int x[1000][2];
  int n = 0;


  while(cin >> a >> b){
    k = a * b;
    while(1){
      if(a == b)
        break;
      compare(&a, &b);
      a = a - b;
    }
    cout << "!!\n";
    x[n][0] = a;
    x[n][1] = k / a;
    n++;
  }

  for(int i = 0; i < n; i++)
    cout << x[i][0] << " " << x[i][1] << '\n';

  return 0;
}