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 <iostream>
#include <cmath>
using namespace std;

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

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

using namespace std;

int max(int x, int y){
        int r;

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

long long int small(long long int x,long long  int y, int r){
        if(x * y % r  == 0)
                return x * y / r;
        else
                return x * y;
}       

int main(){
        int x,y,r;

        while((scanf("%ld %ld",&x,&y)) != EOF){
                if(x < y){
                        int num = y;
                        y = x;
                        x = num;
                } 
                cout << max(x,y) << " " << small(x,y,max(x,y)) << endl;
        }
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

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

int a,b;

int main()
{
    while (~scanf("%d%d",&a,&b)) {
        int x=gcd(a,b);
        int y=1ll*a*b/x;
        printf("%d %d\n",x,y);
    }
}

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

int main()
{
	unsigned long long iNumA, iNumB, iGCD, iLCM, iGCDTemp, iGCDTempL, iLCMTempA[2048], iLCMTempB[2048], iCount, i, j, k;
	bool      TrueFlag;

	while( cin >> iNumA >> iNumB ){

		iGCDTempL = 0;
		iGCDTemp  = iNumB;

		while( iGCDTemp != 0 ){

			iGCDTempL = iGCDTemp;
			iGCDTemp  = iNumA % iGCDTemp;

		}

		iGCD     = iGCDTempL;
		iCount   = 1;
		i	     = 1;
		TrueFlag = false;

		while( 1 ){

			for( j = 1; j <= 2048; j++ ){

				iLCMTempA[j-1] = iNumA * j;
				iLCMTempB[j-1] = iNumB * j;

			}

			for( j = 0; j < 2048; j++ ){

				for( k = j; k < 2048; k++ ){

					if( iLCMTempA[j] == iLCMTempB[k] ){

						iLCM     = iLCMTempA[j];
						TrueFlag = true;
						break;

					}

				}

				if( TrueFlag == true ) break;

			}

			if( TrueFlag == true ) break;

		}

		cout << iGCD << ' ' << iLCM << endl;

	}

	return 0;
}

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

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

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

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}
		else{
			m = a / b;/*/公倍数*/
			m *= B;
			printf("%d\n", m);
		}
	}

	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>
#define L(_i,_N) for(int _i=0;_i<_N;_i++)
#define C(_Dis) cout<<_Dis<<endl;

using namespace std;

typedef long long int lli;

int main() {
	lli a, b,c,i;
	while (cin >> a >> b) {
		if (a > b) swap(a, b);
		c = a*b;
		while (1){
			if (b == 0) break;
			i = b;
			b = a%b;
			a = i;
		}
		cout << a << " " << c / a  << endl;
	}
	return 0;
}

C++: import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(sc.hasNextInt()){
int a=sc.nextInt();
int b=sc.nextInt();
int c=gcd(a,b);
int d=a*b/c;
System.out.printf("%d %d%n",c,d);
}
}
public static int gcd(int x,int y){
int max=Math.max(x,y);
int min=Math.min(x,y);
if(max%min==0){return min;}
return gcd(min,max%min);
}
}

C++: #include<iostream>

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

	return gcd( b, a % b );
}

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

int main(){
	int x,y;
	std::cin>>x>>y;
	
	std::cout<<gcd(x,y)<<' '<<lcm(x,y)<<std::endl;

	return 0;
}

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

long long gcd (long long a, b) {
  if(a < b) {
    int foo = a;
    a = b;
    b = foo;
  }

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

int main() {
  long long a ,b;

  while (scanf("%ld", &a) != EOF) {
    scanf("%ld", &b);
    long long g = gcd(a, b);
    printf("%ld %.3lf\n", g, a * b / g);

  }

  return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cctype>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <iterator>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define ps(ch) printf("%s",ch)
#define NL printf("\n")
#define debug(x) printf("wow %d !!\n",x)

typedef long long LL;

using namespace std;

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

int main()
{
    LL a,b;
    while(sll(a,b)!=EOF)
    {
        LL g = gcd(a,b);
        LL l = a*b/g;
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

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

using namespace std;

int main()
{
	int  a, b, a1, b1, c, g;
	long l;
	
	while (cin>>a>>b)
	{
		a1 = a;
		b1 = b;
		if (a == 0 || b == 0)
		{
			break;
		}


		while (1)
		{
			c = abs(a - b);
			if (c == 0)
			{
				break;
			}

			if (a > b)
			{
				a = c;
				g = c;
			}
			else if (a < b)
			{
				b = c;
				g = c;
			}
		}
		l = (a1 / g)*b1;
		cout << g << " " << l << endl;
		
		a1 = a; b1 = b;
	}
}

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

int gcd(int a, int b)
{
	int c;

	while (a%b)
	{

		c = b;
		b = a%b;
		a = c;
	}
	return b;
}


int main()
{
	int a, b;
	while (scanf("%lld%lld", &a, &b))
	{
		cout << gcd(a, b) << " " <<a/gcd(a,b)*b<< endl;
	}
	return 0;
}

C++: #include "stdio.h"

int main()
{
	int a, b, x, y;

	while(scanf("%d %d", &a, &b)){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

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

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

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

C++: #include<stdio.h>
#include<math.h>
 
int main(){
    unsigned int a,b;
    while(~scanf("%u%u",&a,&b)){
        unsigned int c=a,d=b;
        while(a>0&&b>0){
            if(a>b)a=a%b;
            else b=b%a;
        }
        printf("%u %u\n",a+b,c/(a+b)*d);
    }
}