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;

int gcd(int n, int m) {
  if (n == 0) {
    return m;
  } else if (m < n) {
    return gcd(m, n);
  } else {
    return gcd(m % n, n);
  }
}


int main() {
  long long int n, m;
  while ((cin >> n >> m)) {
    long long int gcd_nm = gcd(n, m);
    long long int lcm_nm = n * m / gcd_nm;
    cout << gcd_nm << " " << lcm_nm << endl;
  }
}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cin >> a >> b;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<stdio.h>
int gcd(int x,int y){
	int r,m;
	if(x < y){
		m=x;
		x=y;
		y=m;
	}
	while(y > 0){
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int main()
{
	unsigned long long int a,b,x,n;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		x=gcd(a,b);
		printf("%lld ",x);
		n=a/x*b;
		printf("%lld\n",n);
	}
	return 0;
}

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

long int key(long int x,long int y);

int main(void) {

  long int a,b;

  while(cin >> a >> b){


    long int gcd = key(a,b);
    long int a2 = (long int)(a/gcd);
    long int b2 = (long int)(b/gcd);
    long int lcm = gcd * a2 * b2;

    printf("%ld %ld\n",gcd,lcm);
  }

  return 0;
}

long int key(long int x,long int y){

  if(y == 0){//???????????´??°???0??????????????§??¬?´???°???0
    return x;
  }else{
    return key(y, x % y);
  }
}

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;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}

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)/tes(a,b);
}

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

long long GCD(long long a, long long b){
	long long r,temp;
	if(a<b)swap(a,b);
	while(b!=0){
		temp=b;
		b=a%b;
		a=temp;
	}
	return a;
}

int main(){
	long long a,b,r;
	while(cin>>a>>b){
		cout<<GCD(a,b)<<' '<<a*b/GCD(a,b)<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(){

	int a = 0, s = 0, d = 0, f = 0, A = 0, S = 0;


		A = a;
		S = s;

		if (a < s){
			d = a;
			a = s;
			s = d;
		}
		while (1){
			if (s == 0){ break; }
			f = a%s;
			a = s;
			s = f;
		}

		printf("%d ", a);

		printf("%d\n", A*S / a);
	

	return 0;
}

C++: #include <iostream>

using namespace std;

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

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		while (1){
			r = a % b;

			if (r == 0){
				break;
			}

			gcd = r;
			a = b;
			b = r;
		}

		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include<iostream>

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

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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

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

using namespace std;

int gcd(int,int);

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

	while(scanf("%d %d",&a,&b) != EOF)
	{
		GCD = gcd(a,b);

		LCM = (a*b) / GCD;

		printf("%d %d\n",GCD,LCM);
	}

	return 0;
}

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

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

using namespace std;

long long a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); ++i)

long long int gcd(long long int a, long long int b) {
    if(b==0) return a;
    return gcd(b, a%b);
}
int main(void){
    long long int a, b;
    while(cin >> a >> b) {
        long long int g = gcd(a, b);
        cout << g << " " << a*b/g << endl;
    }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<cstdio>
using namespace std;

int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		int x = a, y = b;
		while (a%b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		cout << b << " " << x / b*y / b*b << endl;
	}
	return 0;
}

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

int main() {
	long long a, b;
	while (cin>>a>>b) {
		long long G=a,L=b;
		if (G < L)swap(G, L);
		while (G%L != 0) {
			G = G - L*(G/L);
			if(G < L)swap(G, L);
			//cout<<G<<" "<<L<<endl;
		}
		G=min(G,L);
		L=a*b/G;
		cout << G << " " << L << endl;
	}
	return 0;
}

C++: #include<cstdio>
#define MAX(x,y) ((x>y)? x:y)
#define MIN(x,y) ((x<y)? x:y)

long long int a,b,g,h;

int f(long long int x,long long int y)
{
	if(y==0) return x;
	else return f(y,x%y);
}

int main()
{
	while(scanf("%ld%ld",&a,&b)!=EOF)
	{
		g = f(MAX(a,b),MIN(a,b)); 
		h = (a/g)*b;
		printf("%ld ",g);
		printf("%ld\n",h);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define max(x, y) ((x) > (y) ? (x) : (y))
#define min(x, y) ((x) < (y) ? (x) : (y))

template<typename TYPE>
TYPE gcd(TYPE x, TYPE y){
	TYPE r = x % y;
	if (r == 0.0) return y;
	else return gcd(y, r);
}

template<typename TYPE>
TYPE lcm(TYPE x, TYPE y){
	return x * y / gcd(max(x, y), min(x, y));
}

int main()
{
	long long int x, y;
	while (cin >> x >> y){
		cout << gcd(max(x, y), min(x, y)) << ' ' << lcm(x, y) << "\n";
	}
	cout.flush();
	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i/ret_gcd)*j;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j > 0){
		return gcd(j, i%j);
	}else{
		return i;
	}
	
}

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

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