Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }

 }
 return 0; 
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll g,l;

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

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

int main(){
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		g=gcd(a,b);
		l=lcm(a,b);
		printf("%lld %lld\n",g,l);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#define LL long long

LL gcd(LL a, LL b) {
	if (a < b)std::swap(a, b);
	if (a%b != 0)gcd(b, a%b);
	else return b;
}

int main() {
	LL A, B;
	while (std::cin >> A >> B) {
		LL g = gcd(A, B);
		std::cout << g << " " << (A*B) / g << std::endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t;
	
	while(cin >> a >> b){
		for(int i = (a > b)? b : a; i >= 1; i--){
			if(b%i == 0 && a%i == 0){
				cout << i << " ";
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += b;
				}
			} else {
				while(t > s){
					s += a;
				}
			}
		}
		cout << s << endl;
	}
	
	return 0;
}

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    while(cin>>x>>y){
        int g=gcd(x, y);
        int l=x/g*y;
        cout<<g<<' '<<l<<'\n';
    }
    return 0;
}

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  long long int n=0,m=0;
  long long int i=0,j=0,l=0;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

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

using namespace std;

int main()
{
    int a,b;

    while(scanf("%d%d",&a,&b)!=EOF){
        int gcd=a,tmp_b=b;
        int tmp;
        while(tmp_b!=0){
            tmp=gcd%tmp_b;
            gcd=tmp_b;
            tmp_b=tmp;
        }

        printf("%d %d\n",gcd,(int)((long)a*b/(long)gcd));
    }

    return 0;
}

C++: #include<stdio.h>

int max(int a, int b){
  return (a > b) ? a : b;
}

int min(int a, int b){
  return (a < b) ? a : b;
}

int calcGCD(int a, int b){
  int _min, _max, r;
  _max = max(a, b);
  _min = min(a, b);
  r = _max % _min;
  while(r != 0){
    _max = _min;
    _min = r;
    r = _max%_min;
  }
  return _min;
}

int calcLCM(int a, int b){
  int GCD, LCM;
  GCD = calcGCD(a, b);
  LCM = a * b / GCD;
  return LCM;
}
int main(){
  int a, b;
  int list[50][2];
  int j = 0;
  while(scanf("%d%d", &a, &b)!=EOF){
    list[j][0] = calcGCD(a, b);
    list[j][1] = calcLCM(a, b);
    j+=1;
  }
  int i;
  for(i=0; i<j; i++){
    printf("%d %d\n", list[i][0], list[i][1]);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

    if (x < y)
    {
        swap(x, y);
    }

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

    return x;
}

int main( )
{
    int a, b;
    int gcd, lcm;
 
    while(cin >> a >>  b)
    {
        gcd = calcGcd(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl; 
    }

    return 0;
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

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

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

    while( cin >> a >> b )
    {

        if( a > b && a % b == 0 )       //値が大きい場合の最大公約数を先に求めておく
        {
            cout << b << " " << a << endl;
            break;
        }
        if( b <= a && b % a == 0 )
        {
             cout << a << " " << b << endl;
            break;
        }

        for( int i = a; i > 0; i-- ) 
        {
                if( a % i == 0 && b % i == 0 ) 
                {
                    cout << i << " " << a * b / i << endl;
                    break;
                }
        }
    }
    return 0;
}

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

using namespace std;

long int a,b,gcd,lcm;

int main()
{
	while(scanf("%ld %ld", &a, &b) != EOF)
	{
	for(int i=1;i<=a&&i<=b;i++)
	{
		if(a%i==0&&b%i==0)
		{
			gcd=i;
		}
	}
	lcm=max(a,b);
	do {
    if (lcm%a == 0 && lcm%b == 0) {
            break;
        }
        else
            lcm=lcm+gcd;
    }
    while (true);
    printf("%ld %ld\n",gcd,lcm);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


long long gcd(long long x,long long y){
    while(x%y!=0){
        long long tmp;
        tmp=x;
        x=y;
        y=tmp%y;
    }
    return y;
}

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

int main(){
    long long a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        long long g,l;
        if(a<b){
            swap(a,b);
        }
        g=gcd(a,b);
        l=lcm(a,b);
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: #include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
    int t;
    t = a%b;
    if(a%t &&  b%t ){
       return  GCDi(b,t);
    }
    else return t;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){
    while(~scanf("%d%d",&n,&m)){
        int q,r;
        if(n > m){q = GCDi(n,m);r =LCMi(n,m);}
        else if(n > m){q = GCDi(m,n) ;r =LCMi(m,n);}
        else {
            q =n;r = n;
        }
        cout<<q<<" "<<r<<endl;
    }return 0;
}