Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

int main() {
  for(int i = 0; i < 55; i++){
    int a = 0, b = 0, gcd, lcm;
    cin >> a >> b;

    if(a == 0 && b == 0){
      break;
    }
    else{
      int A = max(a, b), B = min(a, b);
      int r = A % B;
      while(r != 0){
        A = B;
        B = r;
        r = A % B;
      }
       gcd = B;

       lcm = gcd * (a / gcd) * (b / gcd);
    }
    cout << gcd << " " << lcm << endl;
  }
}

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*i >= a; 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 <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

using namespace std;

typedef long long ll;

template<class T>
T gcd(T a,T b){
	while(a % b != 0){
		T buf = b;
		b = a%b;
		a = buf;
	}
	return b;
}

int main(){
	ll a,b;
	while(cin>>a>>b){
		ll g = gcd(a,b);
		ll l = a / g * b;

		cout << g << " " << l << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	
	int a, b;
	int temp;
	int big, small;
	
	while(cin>>a>>b){
		
		if(a < b){
			big = b;
			small = a;
		}
		else{
			big = a;
			small = b;
		}
		
		for(;;){
			temp = big % small;
			if(temp == 0){
				break;
			}
			if(temp > small){
				big = temp;
			}
			else{
				big = small;
				small = temp;
			}
		}
		cout << small <<" "<< a/small*b << endl;
	}
}

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

using namespace std;

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

long gcd(long x, long y){
	while(y!=0){	
		long r=x%y;
		x=y;
		y=r;	
	}
	return x;
}

long lcm(long x, long y){
	return (x*y/gcd(x,y));
}

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

	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 main(){
    while(true){
        int a,b;
        cin>>a>>b;

        if(cin.eof()) break;

        int g =gcd(a,b);
        cout<<g<<' '<<a/g*b<<endl;
    }

    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*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

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

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

int main(){
  ll a,b,g,m;
  while(cin>>a>>b){
    g=__gcd(a,b);
    m=a/g*b;
    cout<< g << " " << m <<endl;
  }
    
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
typedef __int64 ll;
ll gcd(ll a,ll b){
    return (b==0)?a:gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
int main(){
    ll a,b;
    while(scanf("%I64d %I64d",&a,&b)!=EOF){
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
    return 0;
}

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

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

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

// int64_t gcd(int64_t a, int64_t b) {
//   if (a == 0 || b == 0) return a + b;
//   return (a < b ? gcd(a, b - a) : gcd(b, a - b));
// }
// 
// int64_t lcm(int64_t a, int64_t b) {
//   return a / gcd(a, b) * b;
// }

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

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 <stdio.h>

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

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

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

int main() {
	int a, b;
	int LCM = 0;	//最小公倍数
	int GCD = 0;	//最大公約数
	while (cin >> a >> b) {
		if (a < b) {
			int temp = a;
			a = b;
			b = temp;
		}
		LCM = a * b;
		while (a%b != 0) {
			int r = a % b;
			a = b;
			b = r;
		}
		GCD = b;
		LCM /= GCD;
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

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

using namespace std;

int getGcd(int x, int y){
	int r;
	while( (r=x%y) != 0 ){
		x=y;
		y=r;
	}
	return y;
}

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

C++: #include <iostream>
#include<sstream>
#include <string>
int gcd( int m, int n )
{
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ???????????????????????????
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main() {
  std::string s;
  int a{},b{};
  
  while (std::getline(std::cin, s)) {
    std::stringstream ss;
    ss<<s;
    ss>>a>>b;
    std::cout<<gcd(a,b)<<' '<<lcm(a,b)<<std::endl;
  }
  return 0;
}