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 <cmath>
using namespace std;

int main() {
	// your code goes here
	long long int a,b;
	long long int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2);
		cout << miner << endl;
		cout << a/miner*b << endl;
	}
	return 0;
}

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

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A%B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

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

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

int gcd(int m, int n);
int lcm(int m,int n);

int main()
{
	int a[50], b[50];
	int set = 0;
	while( cin >> a[set] >> b[set])
		set++;

	for(int i = 0; i < set; i++)
		cout << gcd(a[i], b[i]) << " " << lcm(a[i], b[i]) << endl;

	return 0;
}

int gcd(int m, int n)
{
	int t;
	if(m < n){
		t = m;
		m = n;
		n = t;
	}
	t = m % n;
	while(t != 0){
		m = n;
		n = t;
		t = m % n;
	}
	return n;
}

int lcm(int m, int n)
{
	if(0 == m || 0 == n)
		return 0;
	return ((m / gcd(m, n)) * n);
}

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

int gcd(int a, int b){
	return (b>0)? gcd(b, a%b) : a;
}
int lcm(int a, int b){
	return a / gcd(a, b) * b;
}

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

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

int main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	
	long long int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	for(int j=0;j<nn;j+=2){
		long long int gcd=0,lcm=0;
		for(long long int k=1;k<n[j];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		long long int a=0,b=0;
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

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

int GCD( int x , int y )
{
	if( x < y ){ swap( x,y ); }

	if( x % y == 0 ){ return y ; }
	else{ GCD( y , x%=y ) ; }
}

int main()
{
	unsigned int a,b ;

	while( cin >> a >> b )
	{
		cout << GCD(a,b) << " " << a/GCD(a,b) * b ;
	}

	return 0 ;
}

C++: #include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <sstream>
#include <cctype>
using namespace std;

#define PQ priority_queue
#define P pair<int,int>
#define CLA(array) memset(array,0,sizeof array)
#define CLINF(array) memset(array,0x3f,sizeof array)
#define CLF(array) memset(array,-1,sizeof array)
#define DB(a) cout << "DEBUG " << a << endl;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 100000 + 50;
const int INF = 1 << 30;
LL gcd(LL a,LL b){
    return b==0?a:gcd(b,a%b);
}
LL lcm(LL a,LL b){
    return a/gcd(a,b)*b;
}
int main(){
    LL 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(b==0)
		return a;
		
	return gcd(b,a%b);
}

int main()
{
	while(true){
		int a, b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

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

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

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

C++: #include<cstdio>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;
/*ull gcd(ull m,ull n)
{
    ull t;
    ull a=max(n,m),b=min(n,m);
    while(1)
    {
        t=b;
        if(a%b==0) return b;
        b=a%b;
        a=t;
    }
}*/
ull gcd(ull a,ull b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main()
{
    ull a,b;
    while(~scanf("%I64d%I64d",&a,&b))
    {
        ull t=gcd(a,b);
        printf("%I64d %I64d\n",t,a*b/t);
    }
    return 0;
}

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

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  int i;
  for(i=1;i<=y;i++)
    {
      if((x*i)%y == 0)
	return x*i;
    }
  return x*y;
}



int main(void)
{
  int a,b,k;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	 k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

inline int euclid_alg(const int a, const int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

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

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

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

C++: #include "iostream"
using namespace std;
long long GCM(long long a, long long b)	
{
	long long t;
	while (b)
	{
		t = a%b;
		a = b;
		b = t;
	}
	return a;
}
long long LCM(long long a, long long b, long long x)
{
	long long  t;
	t = (a*b) / x;
	return t;
}
int main()
{
	long long a, b;
	while (1)
	{
		if (cin.eof())
			break;
		else
		{
			cin >> a >> b;
			long long m, n;
			m = GCM(a, b);
			n = LCM(a, b, m);
			cout << m << " " << n << endl;
		}
	}
}