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>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define Rep1(i,k,n) for(int i=k ; i<=n ; i++)
#define rrep(i,n) for(int i=n ; i>=0 ; i--)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

int gcd(int x, int y){
    return y ? gcd(y,x%y) : x;
}

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

    }
}

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

int main(){
	int a,b,gcd=1,lcm=1;
	while(cin >> a >> b){
		int c=a,d=b;
		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<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%lld %lld", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}

		if(b % a){
			t = a / 2;
			for(int i = 2; i <= t; i++){
				if(!(a % i)){
					g = a / i;
					if(!(b % g)){
						printf("%lld %lld\n", g, a * b / g);
						i += t;
					}
				}
			}
		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a,b,c,rest;
	while(1){
		cin >>a>>b;
		int a2=a,b2=b;
		if(a>b){c=a;a=b;b=c;}
		while((rest=b%a)!=0){
			b=a;
			a=rest;
		}
		cout <<a <<" "<<a2/a*b2 << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
// #define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int inf = 1e9;

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

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

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

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

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

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

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

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

int gcd(int a,int b){
  if(a==0||b==0)return 0;
  if(a<b) swap(a,b);
  while(b){
    if(a>b){
      int tmp=a%b;
      a=b;
      b=tmp;
    }
  }
  return a;
}

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


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

C++: #include<stdio.h>
int main(){
	long long int a,b,x,y;
	scanf("%d%d",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b)a-=b;
		else b-=a;
	}
	printf("%d%d",a,x/a*y);
	return 0;
}

C++: #include <iostream>
using namespace std;
 
int get_gcd(int n, int m) {
  while(m) {
    swap(m, n);
    m %= n;
  }
  return n;
}
 
int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a > b) swap(a, b); 
    int gcd = get_gcd(a, b);
    cout << gcd << " " << a / gcd * b << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>

#define sf scanf
#define pf printf

using namespace std;

int GCD(int a,int b)
{
    if(b == 0) return a;
    return GCD(b,a%b);
}
int main()
{
    int a,b;
    while(~sf("%d%d",&a,&b))
    {
        int gcd = GCD(a,b);
        int lcm = a / gcd * b;
        pf("%d %d\n",gcd,lcm);
    }
    return 0;
}

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

int gcd(int a,int b)
{
    int l,s,r;
    if (a<b)
    {
	l=b;
	s=a;
    } else {
	l=a;
	s=b;
    }
    while(true)
    {
	r=l%s;
	if (r == 0) break;
	l=s;
	s=r;
    }
    return s;
}

int main()
{
    int a,b;
    vector<int> r1,r2;
    while (scanf("%d %d",&a,&b) != EOF)
    {
	r1.push_back(gcd(a,b));
	r2.push_back(a/r1[r1.size()-1]*b);
    }
    for (int i=0; i<r1.size(); i++)
    {
	cout << r1[i] << " " << r2[i] << endl;
    }
}

C++: #include <assert.h>
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include <algorithm>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define SZ(a) (int)(a).size()
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define REP(i,n) for (int i=0; i<(n); ++i)
#define ALL(c) c.begin(), c.end()
#define CLR(c,n) memset(c, n, sizeof(c))
#define TR(it, c) for(typeof(c.begin()) it = c.begin();it != c.end(); ++it)
#define CONTAIN(it, c) (c.find(it) != c.end())
typedef vector<int> VI;
typedef pair<int, int> PII;
template <class T> void checkmin(T &a, T b) { if (b<a) a=b; }
template <class T> void checkmax(T &a, T b) { if (b>a) a=b; }
const int INF=0x3F3F3F3F;

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

int main(int argc, char *argv[]) {
  int a, b;
  while (scanf("%d %d", &a, &b) == 2) {
    int g = gcd(a, b);
    printf("%d %d\n", g, a / g * b);
  }
}

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

int main(){ 
    unsigned long long int a,b,n,m;

    while(cin >> a >> b){
        if(a >= b){
            m = a;  
            n = b;  
        }       
        else{   
            n = a;  
            m = b;  
        }       

        while(n != 0){
            unsigned long int i = n;
            n = m % n;
            m = i;  
        }       
        n = a*b/m;

        cout << m << " " << n << endl;
    }
    return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
long gcd(long a, long b){
  if(b == 0){
    return a;
  }
  return gcd(b, a % b);
}
int main(){
  long a, b;
  while(cin >> a >> b){
    cout << gcd(a, b) << " ";
    cout << (a * b) / gcd(a, b) << endl;
  }
  return 0;
}