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() {
		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++: // ConsoleApplication17.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include "iostream"

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << a << " " << a << endl;
		}
	}
	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

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

int main() {
	long long a[2];
	long long tmp;
	long long GCD = 1;
	long long LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		GCD = gcd(a[0], a[1]);

		// ????°???¬?????°????¨????
		LCM = a[0] * a[1] / GCD;

		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int max(long long a,long long b)
{
    if(a>=b)
    return 1;
    else
    return 0;
}
int main()
{
    long long x,y,t,gcd,lcm,a,b;
    while(scanf("%lld%lld",&x,&y)!=EOF)
    {
        if(!max(x,y))
        {
            t=x;x=y;y=t;
        }
        a=x;
        b=y;
        while(x%y)
        {
            x=x%y;
            if(!max(x,y))
        {
            t=x;x=y;y=t;
        }
        }
        gcd=y;
        lcm=a/gcd;
        lcm=lcm*b;
        cout<<gcd<<' '<<lcm<<endl;
    }
    return 0;
}

C++: #include <iostream>

int main(){

	int a, b;

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

		long int minmul; //least common multiple
		int maxdivi = 1; //greatest common divisor
		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<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL gcd(LL a,LL b){
   if(a>b)return gcd(b,a);
   if(b%a==0)return a;
   return gcd(b%a,a);
}
int main(){
        LL a,b;
        while(cin>>a,cin>>b){
	      LL g=gcd(a,b);
	      cout<<g<<" "<<a/g*b<<endl;;
        }
	return(0);
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d, r, s, h;

	while (cin >> a >> b){
		//c
		h = a;
		s = b;
		for (;;){
			r = h % s;
			if (r == 0) {
				c = s;
				break;
			}
			h = s;
			s = r;
		}
		//d
		h = a;
		s = b;
		if (a < b){
			for (;;){
				if ((b % a) == 0){
					d = b;
					break;
				}
				b = b + s;
			}
		}
		else if (a >= b){
			for (;;){
				if ((a % b) == 0){
					d = a;
					break;
				}
				a = a + h;
			}
		}

		cout << c << ' ' << d << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long 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;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(!cin.eof())
	{
		cin >> a >> b;
		ull M = max(a, b);
		ull m = min(a, b);
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a / M * b);
	}
}

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

int main(){
  long long a,b;

  while(cin >> a >> b) 
    cout << __gcd(a,b) << ' ' << a/__gcd(a,b)*b << endl;
  
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <string>
#include <sstream>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repn(i, n) for(int i = 1; i <= (int)n; ++i)
#define pb push_back
#define lb lower_bound
#define mp make_pair
#define ite iterator
#define max2(x, y) ((x) > (y)) ? (x) : (y)
#define max3(x,y,z) max2((x), max2((y),(z)))
#define max4(v,w,x,y) max2(max2((v),(w)), max2((x),(y)))
#define min2(x, y) ((x) > (y)) ? (y) : (x)
#define min3(x,y,z) min2((x), min2((y),(z)))
#define min4(v,w,x,y) min2(min2((v),(w)), min2((x),(y)))
#define ul unsigned long
#define ull unsigned long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

template<typename T>
bool elem(set<T> st, T val){
	return (st.find(val) != st.end());
}

template<typename T>
void printv(vector<T> vt){
    rep(i, vt.size() - 1)
        cout << vt[i] << " ";
    cout << vt[vt.size() - 1] << endl;
}

typedef vector<int> vint;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef pair<int, int> pii;


int main(void){
    ull a, b;
    while(cin >> a >> b){
        ull g = __gcd(a, b);
        ull l = a/g*b;
        cout << g << " " << l << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int,int); //最大公約数
int lcm(int,int); //最小公倍数
int main(){
    int a,b,c,d;
    while (1){
        cin >> a >> b;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
        if(cin.eof()){break;}
    }
}

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

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