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>
#include <math.h>

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

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

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

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(i>a/2) i = a;
    else if(i>b/2) i = b;
    
    if(a%i==0){
      if(b%i==0){break;}
      else{i++;}
    }else{
      i++;
    }
  }
  return i;
}

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

long a, b, g;

long gcd(long a, long b)
{
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

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

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

int main(){
    int a,b;
    
    while(cin >> a >> b){
        
        int g,l;
        g = l = 0;
        
        /* ?????§??¬?´???° */
        while(true){
            int tmp = 0;
            
            if(a <= 3 || b <= 3){
                break;
            }
            
            if((a % 2 != 0 && a % 3 != 0) ||
               (b % 2 != 0 && b % 3 != 0)){
                break;
            }
            
            if(a % 3 == 0 && b % 3 == 0){
                a /= 3;
                b /= 3;
                tmp = 3;
            }
            else if(a % 2 == 0 && b % 2 == 0){
                a /= 2;
                b /= 2;
                tmp = 2;
            }
            
            if(g == 0){
                g = tmp;
            }
            else{
                g *= tmp;
            }
        }
        
        /* ????°???¬?????° */
        while(true){
            int tmp = 0;
            
            if(a <= 3 || b <= 3){
                l *= a;
                l *= b;
                break;
            }
            
            if((a % 2 != 0 && a % 3 != 0) ||
               (b % 2 != 0 && b % 3 != 0)){
                l *= a;
                l *= b;
                break;
            }
            
            if(a % 3 == 0 && b % 3 == 0){
                a /= 3;
                b /= 3;
                tmp = 3;
            }
            else if(a % 2 == 0 && b % 2 == 0){
                a /= 2;
                b /= 2;
                tmp = 2;
            }
            
            if(g == 0){
                l = tmp;
            }
            else{
                l *= tmp;
            }
        }
        
    }
    
    return 0;
}

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

int gcd(int a,int b){
	if(a==0 || b==0) return 0;
	while(a != b){
		if(a>b) a = a - b;
		else b = b - a;
	}
	return a;
}
int lcm(int a,int b){
	if(a==0 || b==0) return 0;
	int tmp = a/gcd(a,b);
	return tmp*b;
}

int main(){
	int 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 main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}

		gcd = y;
		lcm = a * b / gcd;	
	
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: //#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <cstdio>
#include<algorithm>
#include <utility>
#define SIZE 1001;
using namespace std;
int main() {
	long long ans, x, y, memox, memoy;
	while (cin >> x >> y) {
		memox = x; memoy = y;
		if (y > x) {
			swap(x, y);
		}
		while (1) {
			if (y == 0) {
				break;
			}
			x %= y;
			swap(x, y);
		}
		ans = (memox*memoy)/x;
		cout << x << " " << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=15000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    return 0;
}

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

using namespace std;

long long gcd(long long a,long long b)
{
    return !b ? a : gcd(b, a%b);
}

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

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

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

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

int main() {
    long long int a, b;
    while(cin >> a) {
        cin >> b;
        cout << gcd(a, b) << " " << a / gcd(a, b) * b << 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 (;;) {
		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 gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
nt lcm(int a, int b)
{
    return (a * b / gcd(a,b));
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or b <= 0){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << lcm(a,b);
    }
}

return 0;
}

C++: #include <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x*y/a[i];
	     i++;	
	     
	    
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[j],b[j]);
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    // a >= b
    for(ll i = a; i <= (b * a); i += a){
        if(i % b == 0) return i;
    }
}
int main(){
    for(ll a, b; cin >> a >> b;){
        cout << gcd(a, b) << " ";
        if(a > b){
            cout << lcm(a, b) << endl;
        }else{
            cout << lcm(b, a) << endl;
        }
    }
    return 0;
}