Go: package main

import (
  "fmt"
)

func gcd(a, b int) int {
  if b == 0 {
      return a
  }
  return gcd(b, a%b)
}

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

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

long long gcd(long long a, long long b);

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

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

C++: #include <stdio.h>

int main(void){
    long a,b,i=2;
    while(scanf("%ld %ld",&a,&b)!=EOF){
        i=a;
        while(1){
            if(a%i==0&&b%i==0) break;
            i--;
        }
        printf("%ld %ld\n",i,a*b/i);
    }
    return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main() {
 
    long long int ain[50],bin[50];
    long long int a,b,c,d,e,gcm,lcd;
    int loop=50;
    
    for(int i = 0;i<50;i++) {
    	ain[i]=0;
    	bin[i]=0;
        cin >> ain[i] >> bin[i];
        /*if (ain[i]==null) {
        	loop = i;
        	break;
        }*/
    }
    for (int i = 0;i <= loop;i++) {
    a = ain[i];
    b = bin[i];
    if (a==0&&b==0) break;
    if (a < b) {
        c  = a;
        a  = b;
        b = c;
        c=0;
    }
 
    c=a;
    d=b;
 
    for(;;) {
        if(d==0) {
            gcm = c;
            lcd = (a * b) / gcm;
            break;
        }
        e = c % d;
        c = d;
        d = e;
    }
 
    cout << gcm << " " << lcd << endl;
    }
 
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n1,n2,gcd,lcm,c;
    while(scanf("%lld%lld",&n1,&n2)!=EOF)
    {

   c=__gcd(n1,n2);
    lcm=(n1*n2)/c;
        printf("%lld %lld\n",c,lcm);
        }
    return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
 int a,b,c,x,y;
 vector<int> lcm,gcm;
 while(cin >> a >> b) {
 if (a<b) swap(a,b); 
 x=a; y=b;
 while( a % b!=0) { c=b; b=a % b; a=c; }
 lcm.push_back(b); y=y/b; gcm.push_back(y*x);
 }
 for (c=0;c<lcm.size();c++) cout << lcm[c] << " " << gcm[c] << endl; 
 return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;

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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
	T c;
	while (a != 0) {
		c = a; a = b%a;  b = c;
	}
	return b;
}

template<typename T>
T lcm(T m, T n)
{
	return ((m / gcd(m, n)) * n);
}

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

C++: #include <stdio.h>

int main(){
long int a,b,aa,bb;
long int x,y,q;

while(scanf("%d %d",&a,&b) != EOF){
aa=a;
bb=b;
while(a%b!=0){
x=a%b;
a=b;
b=x;
}
q=(aa*bb)/b;

printf("%d %d\n",b,q);
}
return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int gcd(int x,int y){
	int work=0,first=1,answer=0;
	if(x<=y){
		work=x;
		x=y;
		y=work;
	}
	while(1){
		first=x%y;
		if(first==0){
			answer=y;
			return answer;
		}
		x=y;
		y=first;
	}
}
int main(void)
{
	int a=0,b=0;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		else{
			cout<<gcd(a,b)<<" "<<(a*b)/gcd(a,b)<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a,int b) {
  if (a % b == 0) return b;
  else return gcd(b, a % b);
}

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;

long gcm(long a, long b){
	if (a<b) swap(a, b);

	if (a%b == 0)
		return b;
	else
		return gcm(b, a % b);
}

int main(void){

	while (true){
		long a, b, x, y;
		cin>>a>>b;
		if (cin.eof()) break;

		x = gcm(a, b);
		y = a / x * b;
		cout<<x<<" "<<y<<endl;
	}
	return 0;
}

C++: //0005 GCD and LCM
//üÍ³ê½2ÌÅåöñÆÅ¬ö{ðoÍ¹æ
//½¾µAÅåö{Í20­ð´¦È¢

#include<iostream>
using namespace std;

template<class T>
inline T GCD(T a, T b)
{
	T c;
	while( (c = a%b) != 0)
	{
		a = b;
		b = c;
	}
	return b;
}

template<class T>
inline T LCM(T a, T b)
{
	return (a / GCD(a, b) * b);
}

int main(void)
{
	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;}return 0;}

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(a!=0 || b!=0){
        x=a;
        a=b;
        b=x%b;
    }
    cout << a << " " << c/a << endl;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		cout << gcd << " ";

		lcm = (a / gcd) * b;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,GCD,LCM;
    while(cin >> a >> b){
        c = a;
        d = b;
        if((a == 0) && (b == 0)){
            cout << a << " ";
        }
        else{
            while(a != b){
                if(a > b){
                    a = a - b;
                }
                else{
                    b = b - a;
                }
            }
            GCD = a;
            cout << GCD << " ";
        }
        c /= GCD;
        LCM = c * d;
        cout << LCM << endl;
    }
}

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

int solve(int a, int b) {
	int r;
	r = a % b;
	if (r == 0) return b;
	else return solve(b, r);
}

int main() {
	int a, b;
	int gcd, lcm;

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

	return 0;
}

C++: #include<cstdio>
int gcd(int a, int b){
  if(a == 0){
    return b;
  }else if(a > b){
    return gcd(a%b, b);
  }else if(a < b){
    return gcd(b%a, a);
  }
}
int main(){
  int a, b;
  while(scanf("%d%d", a, b)){
    int c=gcd(a,b);
    printf("%d %d\n", c, a*b/c);
  }
}