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

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

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

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
      printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	long long x , y , i , j , tmp , tmp2;
	while( cin >> x >> y ){
		long long n = x>y ? x:y;
		for( i=1 ; i<=n ; i++ ){
			if( x%i+y%i==0 )
				tmp = i ;
		}
		i=n;
		while(1){
			i++;
			if( i%x+i%y==0 ){
				tmp2=i;
				break;
			}
		}
		cout << tmp <<" "<< tmp2 << endl;
	}
}

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

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


int	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,ans);;
	return 0;

}

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

using namespace std;

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

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

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

using namespace std;

int main()
{
    unsigned long x, y;
    
    while (cin >> x >> y)
    {
        unsigned long a = x, b = y;
        while (true)
        {
            unsigned long tmp = b;
            b = a % b;
            a = tmp;
            if (b == 0)
            {
                break;
            }
        }
        cout << a << " " << x / a * y << endl;
    }
    
    return 0;
}

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

int gcd(int a,int b){
	while(1){
		if(a<b)swap(a,b);
		if(!b)break;
		a%=b;
	}
	return a;
}

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

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

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;


long long pgcd(long long a,long long b)
{
    return a==0?b:pgcd(b%a,a);
}

long long ppcm(long long a,long long b)
{
    return a*b/pgcd(a,b);
}

int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<pgcd(a,b)<<" "<<ppcm(a,b)<<endl;
    }
}

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

using namespace std;

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

int main()
{
    while (~scanf("%d%d",&a,&b)) {
        printf("%d %d\n",gcd(a,b),(long long)a*b/gcd(a,b));
    }
    return 0;
}

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>

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

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

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	long long a,b,min,x,y;
	while(cin>>a>>b){
        if(a>b){
            x=a;
            y=b;
        }else{
            x=b;
            y=a;
        }
			while(x%y!=0){
				min=x;
				x=y;
				y=min%y;
				}
			
		cout<<y<<" "<<(a*b/y)<<endl;
	}
	return 0;
}

C++: #include<iostream>

void swap(int *x, int*y)
{
	int temp=0;

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int a=0, b=0, c=0, d=0;

	while(std::cin >> a >> b)
	{	
		c=a;

		d=b;//最小公倍数の計算のため保存

		if(a<b)
		{
			swap(&a,&b);
		}

		while(a%b!=0)
		{
			a = a%b;

			swap(&a,&b);

		}

		std::cout << b << ' ' << c/b*d << '\n';
	}
}

C++: #include <iostream>

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

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

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


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

int main() {
    //freopen("0005.txt", "r", stdin);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << (a / g * b) << "\n";
    }
}

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(aa != 0){
int c = 0;
bb = bb % aa;
c = aa;
aa = bb;
bb = c;
}
int P = a * b;
cout << bb << " " << P / bb << endl;

}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;
#define L long long int
L gcd(L a,L b){
	if(a<b){
		return gcd(b,a);
	}else if(a>b){
		return gcd(a-b,b);
	}else{
		return a;
	}
}

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

return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a*b/gcj;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int main(void){
  int i,j,k,l,m=1,a,b,c[10],d[10],e;
  scanf("%d %d",&a,&b);
  if(a<b){
    k = b;
    b = a;
    a = k;
  }
  j = k = 0;
  for(i=2;i<a;i++){
    if(!(a%i)){
      c[j] = i;
      j += 1;
    }
  }
  for(i=2;i<b;i++){
    if(!(b%i)){
      d[k] = i;
      k += 1;
    }
  }

  for(i=j-1;i+1;i--){
    for(l=k-1;l+1;l--){
       if(c[i] == d[l]){
	printf("%d ",c[i]);
	m = 0;
	e = c[i];
	break;
      }
    }
    if(!m)
      break;
  }
  printf("%d",a*b/e);
  return 0;
}