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() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/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
}

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

int GCD(int a,int b);
int LCM(int a,int b);

int main()
{
	int a,b,gcd,lcm;

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a*b)/GCD(a,b));
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/

C++: #include <iostream>

int gcd(int a, int b);
int lcm(int a, int b);

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

//Greatest Common Divisor
int gcd(int a, int b){
	while(a != b){
		if(a > b) a = a - b;
		else b = b - a;
	}
	return a;
}

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

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

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

void swap(long long int *a, long long int*b) {
	long long int x;
	x = *a;
	*a = *b;
	*b = x;
}

int GetGCD(long long int a, long long int b) {
	if (b > a) { swap(&a, &b); }
	while (a%b != 0) {
		a = a%b;
		swap(&a, &b);
	}
	return b;
}

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

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

int main(){
  int a,b,c,a2,b2;
  while(cin>>a>>b){
    a2=a;
    b2=b;
    while(1){
      if(a2%b2==0)break;
      else {
	c=a2%b2;
	a2=b2;b2=c;
      }
    }
    c=b2;
    c*=a/b2;
    c*=b/b2;
    cout <<b2<<" "<<c<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory>

using namespace std;

#if 1
#define PRINT(x) { cout << #x << ": " << (x) << endl; }
#define PRINT_CONTAINER(x)  { cout << #x << ": ";                       \
        for (size_t ix = 0; ix < (x).size(); ++ix) cout << (x)[ix] << ", "; \
        cout << endl; }
#else
#define PRINT(x)
#define PRINT_CONTAINER(x)
#endif

typedef pair<int, int> p;

int a, b;

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

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

C++: #include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int a,b;
    cin>>a>>b;
    if(a<b)swap(a,b);
    cout<<gcd(a,b)<<endl;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ull gcd(ull a, ull b){while(true){ull k = a % b;if(k == 0)return b;a = b;b = k;}}
ull comb(ull n, ull m){ull p=1;m=min(m,n-m);for(ull i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ull a,b;
        cin>>a>>b;
        if(a==0)return 0;
        ull r1=gcd(a,b);
        ull r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}

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

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

int gcd(int x,int y);

int main(){
   while(true){
      int a,b;
      cin >> a >> b;
      if(cin.eof())
         break;
      int c=gcd(a,b);
      cout << ' ' << a/c*b << endl;
   }
   return 0;
}

int gcd(int x,int y){
   if(y==0)
      return x;
   return gcd(y,x%y);
}

C++: #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <algorithm>
#include <iomanip>
#include <functional>

#define REP(i, n) for(int i = 0;i < (n); i++)
#define REP2(i, x, n) for(int i = (x); i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

using namespace std;

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

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

//================================================

int main() {
	LL A, B;

	while (cin >> A >> B) {
		cout << gcd(A, B) << " " << lcm(A, B) << "\n";
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	unsigned long long a, b;
	while (cin >> a >> b){
		unsigned long long gcd, lcm;
		unsigned long long c, d;
		c = max(a, b);
		d = min(a, b);
		while (true){
			if (c % d == 0) {
				break;
			}
			else{
				gcd = c%d;
				c = d;
				d = gcd;
			}
		}
		lcm = a*b / gcd;
		cout << gcd <<' '<< lcm << endl;
	}
}