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 <iostream>
using namespace std;
int main(){
    int a,b,lcm=0,count=0;
    while(cin>>a>>b){
    for(int k=a;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    cout<<lcm<<" "<<a*b/lcm<<endl;
}
}

C++: #include<iostream>
using namespace std;
typedef unsigned long long ull;
ull a,b;
ull gcd(ull x,ull y){
return y==0?x:gcd(y,x%y);
}
int main(){
    cin>>a>>b;
    ull temp=gcd(a,b);
    ull sum=a/temp*b;
    cout<<temp<<" "<<sum<<endl;
}

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)
{
	return ((m / gcd(m, n)) * n);
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b) {
          int p,q,r;

if(a < b) {
  return gcd(b, a);
}


       if(a<b){p=b;b=a;a=p; 
}


    while(r!=0){
    q=b/a;
    r=b%a;
    b=a;
    a=r;
    }
    return b;
}

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

C++: #include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int a, b;

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

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

C++: #include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)#include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)
      i++;
    else j++;
  }  
  if(a<b){
    for(i=2;i<a+1;i++)
      if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  }
  else {
      for(i=2;i<b+1;i++)
	if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  } 

  cout<<a2<<endl; 
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

//最大公約数
LL gcd(LL n, LL m) {
	if (m == 0)return n;
	return gcd(m, n%m);
}

//最小公倍数
LL lcm(LL n, LL m) {
	LL g = gcd(n, m);
	return n / g * m;
}

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

C++: #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <vector>
using namespace std;

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

int getLcm(long int a, long int b) { return a / b; }

int main(int argc, char const *argv[]) {
  long int ans_gcd, ans_lcm, a, b, tmp;
  while (!(cin >> a >> b).eof()) {
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    ans_gcd = getGcd(a, b);
    ans_lcm = getLcm(a * b, ans_gcd);
    std::cout << ans_gcd << " " << ans_lcm << '\n';
  }
  return 0;
}

C++: include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}
/*
int tes(int a,int b){
  if(b == 0)return a;
  return tes(b,a%b);
}
*/

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

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

int gcd(int a,int b){
	return b ? gcd(b,a%b) : a;
}
int lcm(int a,int b)
{
	return a/gcd(a,b)*b;
}
int main()
{
	int x,y;
	while(cin >> x >> y && x != -1)
		printf("%d %d\n",gcd(x,y),lcm(x,y));
}

C++: #include<iostream>

using namespace std;

int gcd(int x,int y) {//??????????????????????????????
	int r;
	if (x < y)swap(x, y);
	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

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

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600

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

  return 0;
}