Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

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

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

using namespace std;

long int  a, b;
long int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include<iostream>

int main(){
	int a,b;
	
	while( std::cin >> a >> b ){
		int num1 = a;
		int num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (int gcd = num1%num2) != 0){
			num1 = num2;
			num2 = gcd;
		}
		gcd = num2;
		int lcm = a / gcd * b;
		std::cout << gcd <<" "<< lcm << "\n";
	}
	
	return 0;
}

C++: #include <iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
    }
    return 0;
}

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

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

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

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

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

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

using namespace std;


int calcMax(int a, int b) {
	int tmp;
	if (a > b) {
		while (b != 0) {
			tmp = b;
			b = a % b;
			a = tmp;
		}
		return a;
	}
	else {
		while (a != 0) {
			tmp = a;
			a = b % a;
			b = tmp;
		}
		return b;
	}
}

int calcMin(int a, int b) {
	int max_common = calcMax(a, b);
	return (a / max_common)*b;
}


int main() {
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF) {
		printf("%d %d\n", calcMax(a, b), calcMin(a, b));
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  int are;
  int i;
  int cgd,lcm;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0)break;
    if(a == b){
      cout << a << " " << a << endl;
      continue;
    }
    if(a > b){
      int temp = b;
      b = a;
      a = temp;
    }
    cgd = 1;
    for(i = 2;i <= a && i < 65536;i++){
      if(a % i == 0 & b % i == 0){
	cgd = i;
      }
    }
    for(i = b;i < 2147483647;i += b){
      if(i % a == 0 && i % b == 0){
	lcm = i;
	break;
      }
    }
    cout << cgd << " " <<  lcm << endl;
  }
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int a,b,x,y,r;
	while(1){
		cin>>a>>b;
		if(cin.eof())	break;
		x=a;	y=b;
		while(1){
			if(b>a)	swap(a,b);
			r=a%b;
			if(r==0)	break;
			a=b;
			b=r;
		}
		cout<<b<<" "<<x*y/b<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int a,b,A,B;
	while(cin>>A>>B){
		a=A,b=B;

		if(a<b)swap(a,b);
		for(int r;(r=a%b)!=0;)a=b,b=r;

		int L=b,G=A*(B/L);
		cout<<L<<" "<<G<<endl;
	}
	return 0;
}

C++: #include<iostream>
int e(int a,int b){if(a<b)a^=b^=a^=b;return (a%=b)?e(b,a):b;}int f(int a,int b,int c,int d){if(a<b)a^=b^=a^=b;for(;a>b;)b+=d;return a-b?f(b,a,d,c):a;}int main(){for(int a,b,s;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",e(a,b),f(a,b,a,b)));}

C++: #include <iostream>

using namespace std;

int dev(int*,int*,int);

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

	while(cin >> a){
		cin >> b;
		gcd=1;

		gcd*=dev(&a,&b,2);
		for(int i=3;i<(a<b?a:b);i+=2)
			gcd*=dev(&a,&b,i);

		cout << gcd << " " << a*b*gcd << endl;
	}

	return 0;
}

int dev(int *a,int *b,int n){
	int fac=1;
	
	while(*a%n==0&&*b%n==0){
		*a /= n;
		*b /= n;
		fac *= n;
	}

	return fac;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

ll gcd(ll a, ll b)
{
  ll tmp;

  while(b){
    tmp = a;
    a = b;
    b = tmp%b;
  }

  return a;
}

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

ll a, b;

int main()
{
  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;
    cin>>a>>b;
    int a2=a;
    int b2=b;
    
    while(true) {
        if(a>b){
            a=a%b;
        }else{
            b=b%a;
        }
        if(a==0||b==0)break;
    }
    cout<<max(a,b)<<" "<<a2*b2/max(a,b)<<endl;
    return 0;
}

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

C++: // ------------------------------------                                                                  
// Date:2018/ 2/13                                                                                       
// Problem:0005 : GCD&LCM 5.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)

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