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 <iomanip>
#include <stdio.h>
#include <math.h>
using namespace std;

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

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

int main(){
    long long a, b;

	while(scanf("%lld %lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
	}

    return 0;
}

C++: #include <stdio.h> 
#include <algorithm>

typedef long long LL;

LL GCD(LL a, LL b){
	if (a<b) std::swap(a, b);
	LL lcm = a * b; 
	while (b != 0)  { 
		LL gcd = a % b; 
		a = b; 
		b = gcd; 
	} 
	return a;
}

int main(){
	LL a, b;
	while (~scanf("%lld%lld", &a, &b)){
		LL tmp = GCD(a, b);
		printf("%lld %lld\n", tmp, a*b/tmp);
	}
	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 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 <cstdio>
#include <cstdlib>

using namespace std;


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

int main()
{
	long a, b, d;

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

C++: #include<iostream>
using namespace std;
int main(){
  long long  a,b;
  while(cin>>a>>b){
    //Eucledean algorithm                                                                                                     
    long long c,d,r,GCD,LCM;
    c=a;d=b;
    do{
      r=c%d;
      c=d;d=r;
    }while(r);
    GCD=c;
    LCM=a*b/GCD;
    cout << GCD << ' ' << LCM <<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (Integer a, b; cin >> a >> b, cin; ) {
    Integer x = max(a,b);
    Integer y = min(a,b);
    while (y > 0) {
      x %= y;
      Integer t = x;
      x = y;
      y = t;
    }
    //cerr << cons(a,b) << ' ' << cons(x, y) << endl;
    cout << x << ' ' << (a / x * b) << endl;
  }

  return 0;
}

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

int main(){
  bool is_prime[1000000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<1000000; i++){
    is_prime[i]=true;
  }

  for(int i=2; i*i<1000000; i++){
    if(is_prime[i]){
      for(int j=i*i; j<1000000; j+=i){
        is_prime[j]=false;
      }
    }
  }

  int n_prime[1000000];
  int cnt=0;

  for(int i=0; i<1000000; i++){
    if(is_prime[i]){
      cnt++;
    }
    n_prime[i]=cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
      break;

    cout << n_prime[n] << endl;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(!cin.eof())
	{
		cin >> a >> b;
		ull M = max(a, b);
		ull m = min(a, b);
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a * b / M);
	}
}

C++: #include<stdio.h>
main(a,b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);
}

C++: #include <iostream>
int gcd(int a, int b)
{
  while (1) {
    if (b == 0) {
      return a;
    }
    int temp = b;
    b = a % b;
    a = temp;
  }
}

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

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

C++: #include<stdio.h>



//公約数
long long int kouyakusuu_f(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	//怖いからここでiを宣言
	long long int i = 0;

	//お互いを割って０なら小さいほうを返す(6と１２　高速道路)
	if (hozon1 % hozon2 == 0)
	{
		return hozon2;
	}
	if (hozon2 % hozon1 == 0)
	{
		return hozon1;
	}
	//それでも駄目なら小さいほうを２で割る
	if (hozon1 < hozon2)
	{
		i = hozon1 / 2;
	}
	else
	{
		i = hozon2 / 2;
	}


	while (1)
	{
		if (hozon1 % i == 0 && hozon2 % i == 0)
		{
			return i;
		}
		//２個ずつ減らす
		i -= 2;
	}

}





//公倍数
long long int koubaisuu(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	long long int cnt1 = 1,cnt2 = 1;

	//保存１を保存２で割ると０のとき
	if (hozon1 % hozon2 == 0)
	{
		return hozon1;
	}
	//保存２を保存１で割ると０のとき
	if (hozon2 % hozon1 == 0)
	{
		return hozon2;
	}
	
	//合うまで回す
	while (1)
	{
		if (hozon1 == hozon2)
		{
			return hozon1;
		}
		while (hozon1 < hozon2)
		{
			cnt1++;
			hozon1 = *a * cnt1;
		}
		while (hozon1 > hozon2)
		{
			cnt2++;
			hozon2 = *b * cnt2;
		}
	}

	return hozon1;
}




int main(void)
{
	//入力変数
	long long int a = 0,b = 0;
	//出力変数
	long long int ans1 = 0, ans2 = 0;

	//回す
	while (scanf("%lld %lld",&a,&b) != EOF)
	{
		//計算してもらう(公約数)
		ans1 = kouyakusuu_f(&a,&b);
		//次は公倍数
		ans2 = koubaisuu(&a,&b);
	
		//表示
		printf("%lld %lld\n",ans1,ans2);
	}


	return 0;
}

C++: #include<stdio.h>
long long  GCD(long long m,long long n)
{
    long long t,r;
    if(n>m)
   {
   	t=m;
   	m=n;
	n=t;
	}
	while(n!=0)
	{
		r=m%n;
		m=n;
		n=r;
	}
	return m;
}
long long LCM(long long m,long long n)
{
    long long num;
    num=(n*m)/GCD(m,n);
    return num;
}
int main()
{
    long long n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        printf("%d %d\n",GCD(m,n),LCM(m,n));
    }
    return 0;

}

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

typedef long long ll;

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

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

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

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

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}