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<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long ull;
typedef long long ll;

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;

typedef pair<int ,int > P;

int n,m;

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;
}

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

	return 0;
}

C++: #include <cstdio>
int gcd(int a,int b)
{
    return b? gcd(b,a%b):a;
}
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b) != EOF)
    {
        int g = gcd(a,b);
        int l = a/g*b;
        printf("%d %d\n",g,l);
    }
}

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

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm,status,temp;
	while(1){
		status=scanf("%d%d",&a,&b);
		
		if (status==EOF) break;
		
		if (a>b){
			temp=b;
			b=a;
			a=temp;
		}
		
		gcd=a;
		
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=(int)(1.0*a*b/gcd);
		
		if (a*b==gcd)lcm=1;
		if (a==gcd) lcm=b;

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

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

int Func_gcd(int num1, int num2){
	int surplus;
	
	if(!num2){
		return num1;
	}
			
	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
    int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = (num1*num2)/gcd;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t;
	
	while(cin >> a >> b){
		for(int i = (a > b)? b : a; i >= 1; i--){
			if(b%i == 0 && a%i == 0){
				cout << i << " ";
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				t += b;
			} else {
				s += a;
			}
		}
		cout << s << endl;
	}
	
	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;
  while(a!=b)
    {
      if(a>b)a=a-b;
      else{b=b-a;}
    }
  return a;
}
/*
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<cstdio>
typedef unsigned long long ll;
int gcd(int a,int b)
{
	if(b==0)return a;
	else return gcd(b,a%b);
}
int main()
{
	ll n,m;
	while(scanf("%d%d",&n,&m)==2)
	{
		ll d = gcd(n,m),ans = n*m/d;
		printf("%lld %lld\n",d,n*m/d);
	}
	return 0;
}

C++: #pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>

using namespace std;
using Int = long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rer(i,l,r) for(int(i)=(l); (i)<(r); ++(i))
#define rep(i,n) rer(i,0,n)
#define gnr(i,l,r) for(int (i)=(r)-1; (i)>=(l); --(i))
#define pri(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<(p).fi<<' '<<(p).se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

int main(){
  cin.tie(nullptr); ios::sync_with_stdio(0);
  //cout<<fixed<<setprecision(20);
  
  while(cin>>n>>m){
    cout<<__gcd(n,m)<<' '<<n/__gcd(n,m)*m<<'\n';
  }
}

C++: #include<iostream>
using namespace std;
int GCD(int a,int b)
{int c,d;
if(a<b)
{d=a;
 a=b;
 b=d;
}
 while(b!=0)
 {c=a%b;a=b;b=c;
 }
 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;
 }
 return 0;
}

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

using namespace std;

/*
Runtime ErrorªN±éB
fTõðàÁÆVvÉB
»ÝÍO(n^2)ÈÌÅAÅª2000000000
*/

void solve(int a, int b) {
	int max_num = max(a,b);
	int gcj = 0;
	for (int i=0; i<max_num; i++) {
		if (a%i==0 && b%i==0)
			gcj = max(gcj, i);
	}
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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


int gcd(int a, int b){ return a%b ? gcd(b, a%b) : b; }
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;
}
return 0;
}

C++: #include<iostream>

using namespace std;

//Euclidean algorithm
int gcd(long m, long n)
{
	long t;
	while (m != 0) {
		t = m, m = n % m, n = t;
	}
	return n;
}

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



int main(){
	long n, m;
	
	while(cin >> n >> m) {
		cout << gcd(n, m) << " " << lcm(n, m);
	}

	return 0;
}