Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #include<stdio.h>

int main(void)
{
	long int x[1000],x2[1000],y[1000],y2[1000],z[1000],i=0,j=0,gcd[1000]={0},lcm[1000]={0};

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
	    i=i+1;
	}
	for(j=0;j<i;j++)
	{
		while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   gcd[j]=y[j];

	   lcm[j] = x2[j] * (y2[j] / gcd[j]);
	   
	   printf("%d %d\n",gcd[j],lcm[j]);
	}
  return 0;
}

C++: #include <iostream>

using namespace std;

int _GCD(int a, int b);
int _LCM(int a, int b);

int main()
{
	int a, b;
	
	while (cin >> a >> b) {
		cout << _GCD(a, b) << " " << _LCM(a, b) << endl;
	}
	
	return 0;
}

int _GCD(int a, int b) {
	int r;
	
	if (a < b) {
		r = a; a = b; b = r;
	}
	
	do {
		r = a % b;
		a = b;
		b = r;
	} while (r != 0);
	
	return a;
}

int _LCM(int a, int b)
{
	return (a / _GCD(a, b)) * b;
}

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

double x,y,n,a,b;

while(cin>>x>>y)
{
a=x;
b=y;
if(x>y)
while(x%y!=0)
{
n=x%y;
x=y;
y=n;
cout<<y<<" "<<a*b/y<<endl;
}
else
while(y%x!=0)
{
n=y%x;
y=x;
x=n;
cout<<x<<" "<<a*b/x<<endl;
}

}
return 0;
}

C++: #include<iostream>
typedef unsigned long long int ull;

using namespace std;
ull gcd(ull x1, ull x2){
  if(x1 == 0) { return x2; }
  if(x2 == 0) { return x1; }
  if(x1 > x2){
    return gcd(x1 % x2, x2);
  } else {
    return gcd(x1, x2 % x1);
  }
}
ull lcm(ull x1, ull x2){
  return x1 * x2 / gcd(x1, x2);
}

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

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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define FORR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()             
#define MP( a, b )		make_pair( (a), (b) )
#define fi				first
#define se				second

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

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

signed main() {
	int x, y;
	while( cin >> x >> y ) {
		int a = gcd( x, y );
		cout << a << " " << x * y / a << endl;
	}
}

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

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	
	while(cin >> a >> b)
	{
		c = a;
		d = b;
		
		while(c != d){
			if(c < d){
				c = a * i;
				i++;
			}else if(c > d){
				d = b * j;
				j++;
			}
		}
		
		/**********************************/
		
		int e, f;
		int k = 2;
		int l = 2;
		e = a;
		f = b;
		
		while(e != f){
			if(e > f){
				e = a / k;
				k++;
			}else if(e < f){
				f = b / l;
				l++;
			}
		}
		
		
		cout << e << " " << c << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstdlib>
#include <math.h>
using namespace std;
 
const int MAX_N=10000;
unsigned long long int a,b;

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

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

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

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int gcd(int m ,int n){
	if(n==0) return m;
	else return(n,m%n);
}

int main(){
         long int a ,b ,g ,l;
		 while(scanf("%ld %ld",&a,&b)!=EOF){
			g = gcd(a,b);
			l = a/g*b;
			printf("%ld %ld\n",g,l);
		 }
		 return 0;
}

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

int gcd(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;

	while(m != n)
	{
		if(m > n) m = m -n;
		else n = n -m;
	}

	return m;
}

int lcm(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;
	return ((m / gcd(m,n)) * n);
}


int main()
{
	int a,b,c,x,y;
	while(cin >> a >> b)
	{
		cout << gcd(a,b) << " " << lcm(a,b)<< endl;
	}
	return 0;
}

C++: #include<stdio.h>



unsigned long int gcd(unsigned long int one,unsigned long int two){		//Ååöñ
	
	unsigned long int temp,mod;
	
	if(one<two){
		temp=one;
		one=two;
		two=temp;
	}
	
	while(two!=0){
		
		mod=one%two;
		
		if(mod==0){
			
			return two;
		
		}else if(mod!=0){
			one=two;
			two=mod;
		}
	}
	return 0;
}


unsigned long int lcm(unsigned long int one, unsigned long int two){		//Å¬ö{
	return (one/gcd(one,two))*two;
}
	
int main(void){

	unsigned long int first,second;
	

	while(scanf("%d %d",&first,&second)!=EOF){
		
		if(first<=0||second<=0){
			break;
		}
		printf("%d %d\n",gcd(first,second),lcm(first,second));
	}
	
	return 0;
}

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

int u(int a, int b);
int l(int a, int b, int gcd);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b, gcd);
    std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(1){
    if(a==0) return b;
    if(b==0) return a;
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
}

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

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

using namespace std;

int main()
{
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)==2){
        int c;
        int d;
        if(a<b)
            d=a;
        else
            d=b;
        for(c=d;c>=2;c--){
            if(a%c==0 && b%c==0)
                break;
        }

        int e=a+b-d;
        //if(a>b)
          //  e=a;
       // else
          //  e=b;
        //int f;
        for(;;e++){
            if(e%a==0 && e%b==0)
                break;
        }
        cout << c << " " << e << endl;

    }
    return 0;
}

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

using namespace std;


int main() {

	int a, b, c=1, GCD, LCM , d,???e;

	while (cin >> a >> b) {
		d = a;
		e = b;
		while (c) {
			c = a % b;
			if (c == 0) {
				GCD = b;
				break;
			}
			else {
				a = b;
				b = c;
			}
		}
		d /= GCD;
		e /= GCD;
		LCM = d*e*GCD;

		cout << GCD << " " << LCM << endl;
		c = 1;
	}

	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 lcm(int a, int b){
	return a/gcd(a,b)*b;
}

int main(){
	int n,m;
	while(cin>>n>>m){
		cout<<gcd(n,m)<<" "<<lcm(n,m)<<endl;
	}
}

C++: #include<iostream>

int main(){
	int x,y;
	std::cin>>x>>y;
	
	for(int j=x;j>0;--j){
		if(x%j==0&&y%j==0){
			std::cout<<j<<' ';
			break;
		}
	}

	for(int i=x;i>0;++i){
		if(i%x==0&&i%y==0){
			std::cout<<i<<std::endl;
			break;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long long a,b;
int main(){
	while(cin>>a>>b){
		int D=__gcd(a,b);
		cout<<D<<' '<<a*b/D<<endl;
	}
}

C++: #include<stdio.h>
int main(void)
{
	int a,aa,b,bb,c,s,ss;
	while(scanf("%d %d",&a,&b)!=EOF){
		aa=a;
		bb=b;
		if(a<b){
			c=a;
			a=b;
			b=c;
		}
		while(1)	{
			if(a%b==0)	{
				break;
			}
			else	{
				c=a%b;
				a=b;
				b=c;	
			}
		}
		s=b;
		ss=aa*bb/b;
		printf("%d %d\n",s,ss);
	}
	return 0;
}