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() {
		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 <iostream>
using namespace std;

int main()
{
    long long int a,b,c,d,tmp=0;
    
    while(cin >> a >> b){
        if (a<b) {
            swap(a,b);
        }
        
        c = a;
        d = b;
        
        while (b) {
            tmp = b;
            b = a % b;
            a = tmp;
        }
        
        cout << a << " " << c*d/a << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b;cin>>a>>b;cout<<__gcd(a,b)<<" "<<a/__gcd(a,b)*b<<endl;return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#define MAX 500000
using namespace std;

int p[MAX];

int main()
{
	//素数
	fill(p, p + MAX, 1);
	for (int i = 2; i < MAX; i++){
		int sqrti = (int)sqrt(i);
		for (int j = 2; j <= sqrti; j++){
			if (i % j == 0){
				p[i] = 0;
				break;
			}
		}
	}

	long long int a, b;
	while (cin >> a >> b){
		long long int gcm = 1;
		bool flag = true;
		while (flag){
			for (int i = 2;; i++){
				if (p[i] == 1 && a % i == 0 && b % i == 0){
					gcm = gcm * i;
					a = a / i;
					b = b / i;
					break;
				}
				if (i == min(a, b)){
					flag = false;
					break;
				}
			}
		}
		long long int lcm = gcm * a * b;
		cout << gcm << " " << lcm << endl;
	}
	return 0;
}

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

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

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

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

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

using namespace std;

/*Assumption:a > b*/
int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

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

int main() {
  int a, b, c;
  while(cin >> a >> b) {
    //    swap(a, b);
    c = gcd(a, b);
    cout << c << ' ' << lcm(a, b, c) << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: #include<stdio.h>
typedef unsigned long long ullong;

ullong gcm(ullong a,ullong b){
    ullong m = a%b;
    while(m){
        a = b;
        b = m;
        m = a%b;
    }
    return b;
}

int main(){
  ullong a,b,g;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    g = gcm(a,b);
    printf("%lld %lld\n",g,(a*(b/g)));
  }
}

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

int main(void){
    int a,b,c,d,x,ans01,ans02;
    int count;
    while(std::cin >> a >> b && count <= 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b;
 
  while(cin >> a >> b){
    int g = __gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
  return 0;
}

C++: //先辗转相除找gcd再通过gcd求lcm
#include <bits/stdc++.h>

using namespace std;

long long a,b;

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

int main()
{
	while(scanf("%lld%lld",&a,&b)!=EOF)
	{
		long long yin=gcd(a,b);
		long long ax=a/yin,bx=b/yin;
		printf("%lld %lld\n",yin,ax*bx*yin);
	}
	return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int GCD(int a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
int LCM(int a, int b)
{
    return a / GCD(a, b) * b;
}
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a/n*b << endl;
    }
 
    return 0;
}

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

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

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

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>
#include <cstdio>
#include <cstring>
using namespace std;

const int maxn = 1e7+7;
const int INF=0x3f3f3f3f;
typedef long long LL;
LL gcd(LL a,LL b){
return b==0?a:gcd(b,a%b);
}

int main(){

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

return 0;
}

C++: #include<stdio.h>

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

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

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) != EOF){
    printf("%d %d\n", gcd(x, y), lcm(x, y));
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,lcm=0,r,x,y,count=0;
    while(cin>>a>>b){
        count++;
        if(count==50)break;
        x=a;
        y=b;
        while(1){
        r=a%b;
        a=b;
        b=r;
        if(r==0)break;
        }
        lcm=a;
    cout<<lcm<<" "<<x*y/lcm<<endl;
}
}

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

using namespace std;

int gcd(int a,int b){
  return b?gcd(b,a%b):a;
}

int main(void){

  int a,b;

  cin >> a >> b;

  int res=gcd(a,b);
  cout << gcd(a,b) << " " << a/res*b << endl;

  return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
	int a, b, r, x, temp;
	cin >> a >> b;
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF){
		int sa = a, sb = b;
		int c;
		while(b){
			c = a % b;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, sa / a * sb);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	if(b>a)	swap(a,b);
	while(a%b!=0){
		int tmp=a%b;
		a=b;	b=tmp;
	}
	return b;
}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int g=gcd(a,b);
		cout<<g<<" "<<a/g*b<<endl;
	}
	return 0;
}