Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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.Printf("%d %d\n", y, lcm/y)
	}
}

C++: 
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	long long a, b;
	while (cin >> a >> b)
	{
		int A, B;
		A = saisho(a,b);
		B = saidai(a, b);
		cout << A << " " << B<<endl;
	}
	return 0;

}
int saidai(int N, int M)
{
	int n = N, m = M;

	int s = 1;
	while (true)
	{
		if ((s*n) % m == 0)
		{
			break;
		}
		else { s++; }
	}
	return s*n;
}

int saisho(int N, int M)
{
	int n = N, m = M;
	while (true)
	{
		if (n == 0) { return m; break; }
		if (m == 0) { return n; break; }
		if (n > m) { n -= m; }
		else { m -= n; }
	}
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

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

int main(){
	int a,b;
	while(cin>>a>>b){
		int a2=a;
		int b2=b;
		while(true){
			if(a>b){
				a=a%b;
			}else{
				b=b%a;
			}
			if(a==0||b==0)break;
		}
	cout<<max(a,b)<<" "<<a2/max(a,b)*b2<<endl;
	}
	return 0;
}

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

int main() {
	
	int a, b;
	int lcm, gcd;
	for (int j = 0;j < 50;j++) {
		cin >> a >> b;
		int i = 2;
		lcm = 1;
		while (i <= a && i <= b) {
			if (a % i == 0 && b % i == 0) {
				lcm *= i;
				a /= i;
				b /= i;
			}
			else i++;
		}
		printf("%d %d\n", lcm, a * b * lcm);
	}

	//system("pause");
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    }
    
    cout << small << ' ' << (a / small) * (b / small) * small << endl; 

    return 0;
}

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

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

 GCD(b, a%b);
}

int LCM(int a, int b)
{
 int c = GCD(a, b);

 return a*b/c;
}

int main()
{
 int a, b;
 cin >> a >> b;

 cout << GCD(a, b) << ' ' << LCM(a, b) << '\n';

 return 0;
}

C++: 
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
    
#define ll (long long)
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)


using namespace std;


int main(void)
{
    
    int  number1, number2;
    long long answer2 = 0; int answer1;
    int temp;
    int i;
    long long answer2array[1000] = {1};
    int answer1array[1000] = {0};
    int counter = 0;
    
    while(cin >> number1 >> number2)
    {
        /*?????§??¬?´???°???????±???????*/
        int x = 0, y = 0, x2 = 0, x1 = 0;
        if(number1 > number2)
        {
            x = number1;
            y = number2;
            x1 = x;
            x2  = y;
        }
        else
        {
            x = number2;
            y = number1;
            x1 = x;
            x2 = y;
            
        }
        while(x % y)
        {
            temp = (x % y);
            x = y;
            y = temp;
        }
        answer1 = y;
        /*????°???¬?????°????±???????*/
        for(i = 1;i<=x2;i++)
        {
            if((x1*i)%x2 == 0)
            {
                answer2 = (long long)(x1*i);
                break;
            }
        }
        
        answer2array[counter] = answer2;
        answer1array[counter] = answer1;
        counter++;
        }
        REP(i, counter)
    cout << answer1array[i] << " " << answer2array[i] << endl;
    return 0;
    

    }

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a/__gcd(a,b)*b);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i;
while(cin>>a>>b){
int max=0,min;
i=1;
while(r!=0){
r=x%y;
x=y;
y=r;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

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

int gcd(int a,int b)
{
	return b==0?a: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;
}

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

int main()
{
	int a,b;
	while(true){
		cin >> a;
		if(cin.eof())
			break;
		cin >> b;

		int a1=0,b1=0;
		a1=a;
		b1=b;

		int sum=0;
		while(a1%b1!=0){
			sum = b1;
			b1 = a1%b1;
			a1 = sum;
		}

		int g=0,m=0;
		g=b1;
		m=a/g*b;

		cout << g << ' ' << m << endl;
	}
	return 0;
}

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

C++: #include <cstdlib>
#include <iostream>
#include <iomanip>
#include <stdio.h>

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);

    long a,b,c,d;
    while (std::cin >> a >> b) {
        if (a > b){
            c = a;
            d = b;
        }else{
            c = b;
            d = a;
        }
        long temp;
        while (c % d != 0){
            temp = d;
            d = c % d;
            c = temp;
        }
        std::cout << d << " " << a*b/d << std::endl;
    }
    return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int lcm( int a, int b )
{
	int temp = __gcd( a, b );

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

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

int main(){
  int a, b;

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

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

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

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

int getLcm(int x, int y){
  for(int i=1;;i++)
    if(i%x==0 && i%y==0) return i;
}

int main(){
  int a,b;
  while(scanf("%d%d",&a,&b)!=EOF)
    printf("%d %d\n",getGcd(a,b),getLcm(a,b));
}

C++: #include <cstdio>
#include <stdlib.h>
#include <algorithm>
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define abs(x)    ((x) < 0 ? -(x) : (x))
#define INF 0x3f3f3f3f
#define delta 0.85
#define eps 1e-3
#define PI 3.14159265358979323846
#define MAX_V 10005
#define MAX_E 10000000
using namespace std;

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

int main(){
	int a, b;
	while(~scanf("%d%d", &a, &b)){
		int c = gcd(a, b);
		printf("%d %d\n", c, a * (b / c));
	}
	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 * b) / __gcd(a,b)<<endl;
	}
}