Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include <iostream>
using namespace std;
long long a1,a2;
long long gcd,lcm;

long long GCD(long long a,long long b){
    long long i = 2;
    long long minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (i = 1; i <= minimum; i++) {
            if (a % (minimum - i + 1) == 0 & b % (minimum - i + 1) == 0) {
                i = minimum - i + 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
ll gcd( ll a, ll b ) {
  if ( b == 0 ) return a;
  return gcd( b, a % b );
}
 
int main() {
  ll a,b;
  while ( cin >> a >> b ) {
  ll ans = gcd(a,b);
  ll ans2 = a * b / ans;
  cout << ans << " " << ans2 << 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() {
  for(int a, b; cin >> a >> b; ) {
    int g = gcd(a,b);
    cout << g << " " << a / g * b << endl;
  }
}

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

int main(){
	int a,b,gcd,lcm;
	while(cin >> a >> b){
		int c=a,d=b;
		lcm=gcd=1;
		for(int i = 2; i < c || i < d;){
			if(c%i==0&&d%i==0){
				c/=i;
				d/=i;
				lcm=gcd*=i;
			}else i++;
		}
		lcm*=c*d;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

void calcGCDLCM(unsigned int in1, unsigned int in2,
    unsigned int* GCD, unsigned int* LCM) {
  unsigned int num1, num2;
  unsigned int denom=2;
  unsigned int tempGCD=1;

  if(in1>in2) {
    num1=in2;
    num2=in1;
  } else {
    num1=in1;
    num2=in2;
  }

  while(denom <= num1) {
    if(num1 % denom == 0 && num2 % denom == 0) {
      tempGCD *= denom;
      num1 /= denom;
      num2 /= denom;
    } else {
      denom++;
    }
  }

  *GCD = tempGCD;
  *LCM = tempGCD*num1*num2;
}

int main() {
  unsigned int in1, in2;
  unsigned int GCD, LCM;

  while(cin >> in1 >> in2) {
    calcGCDLCM(in1,in2,&GCD,&LCM);
    cout << GCD << " " << LCM << endl;
  }
  return 0;
}

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

int main() {
  int p, q;
  int a, b, c;
  int lcm, gcd;

  while (1) {
    cin >> p >> q;
    if (cin.eof()) break;
    if (p > q) {
      a = p;
      b = q;
    } else {
      b = p;
      a = q;
    }

    while(a%b) {
      c = a-b;
      a = b;
      b = c;
    }
    lcm = b;
    gcd = p/lcm*q;
    cout << lcm << " " << gcd << endl;
  }
  return 0;
}

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

using namespace std;
#define lli unsigned long long int

lli gcd(lli a,lli b){
  lli c;
  while(a!=0){
    c=a; a=b%a; b=c;
  }
  return b;
}


int main(){
  lli a,b;
  while(~scanf("%lld%lld",&a,&b)){
          
    lli tmp1=gcd(a,b);
    lli tmp2=a*b/tmp1;
    printf("%lld %lld\n",tmp1,tmp2);

  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        cout << g << " " << a << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d", 0, 0);
    } else {
      printf("%d %d", a * b / m, m);
    }
  }
  return 0;
}

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

long long int GCD_Num(long long int a, long long int b)      //最大公约数
{
    long long int MAX=max(a,b);
    long long int MIN=min(a,b);
    long long int op;
    while(MAX%MIN!=0){
        op=MAX%MIN;
        MAX=MIN;
        MIN=op;
    }
    //cout<<MIN;
    return MIN;
}

void LCM_Num(long long int a, long long int b)
{
    long long int temp_lcm;
    temp_lcm=(a*b)/GCD_Num(a,b);
    cout<<GCD_Num(a,b)<<" "<<temp_lcm<<endl;
}

int main()
{
    long long int a,b;
    while(cin>>a>>b){
        GCD_Num(a,b);
        LCM_Num(a,b);
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
#include <limits>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#define endl '\n'
#define INF (214748347/2)
#define LL long long
#define PII pair<int, int>
using namespace std;
const int MAXN = 40;

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << a / g * b << "\n";
    }
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}

// deps: gcd
constexpr int lcm(const int &a, const int &b) {
  return a * b / gcd(a, b);
}

void solve() {
  int a, b;
  while (cin >> a >> b) cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}