Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}

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

void swap(int& a, int& b)
{
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
}

int gcd(int a, int b) // a>b
{
        int rem;
        rem = a%b;
        if(rem == 0){ return b; }
        else{ gcd(b, rem); }
}

int main()
{
        int a, b;
        int g, l;

        while(scanf("%d %d", &a, &b) != EOF){
                if(a<b){ swap(a, b); }
                g = gcd(a, b);
                l = a/g*b;
                cout << g << " " << l << endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;
long long gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  cin>>a>>b;
  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;
  return 0;
}

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

C++: #include <iostream>
using namespace std;
int main()
{
   int a,b,d,e;
  cin>>a>>b;
  for(int i = a; i>0;i--){
    if(a%i== 0&& b%i == 0)
        d = i ;
}
 for(int j = a; j <= a*b;++j){
     if(j%a == 0&& j%b == 0){
       e =j;
     }
 }

 cout<<d<<" "<<e<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
long gcd(long a, long b) {
  while (b != 0) {
    long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long lcd(long a, long b) {
  long g = gcd(a, b);
  return (a * b) / g;
}
int main() {
  long a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcd(a, b) << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
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 a,b;
	while(cin>>a>>b) {
		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
	}
	return 0;
}

C++: #include <cstdio>
#include<iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstring>
#include <string.h>
#include<vector>
#include <set>
#include <vector>
#include <iterator>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}
 ll LCM(ll a, ll aa, ll b)
 {
    return a % b == 0 ? a : LCM(a + aa, aa,b);
 }

 int main()
 {
     ll a, b;
     while(~scanf("%lld %lld", &a, &b))
     {
         printf("%lld %lld\n", gcd(a, b), LCM(a, a, b));
     }
     return 0;
 }

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

long gcd(long, long);

int main()
{
	long a,b;

	while(cin>>a>>b){
		long lcm=a*b/gcd(a,b);
		cout<<gcd(a,b)<<" "<<lcm<<endl;
	}

	return 0;

}

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

C++: #include <iostream>
int gcd(int a, int b) {
	return (a ? gcd(b % a, a) : b);
}
int main() {
	int a, b, x;
	while (std::cin >> a >> b) {
		x = gcd(a, b);
		std::cout << x << " " << a / x * b << std::endl;
	}
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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

C++: #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;


int main(void) {
	int a, b;
	while(cin >> a >> b){
	int gcd = 1, lcm = a * b;
	if(a < b){
		a ^= b;
		b ^= a;
		a ^= b;
	}
	for(int i = 1;;i++){
		if(a * i % b == 0){
			lcm = a * i;
			break;
		}
	}
	for(int i = 2; i <= b; i++){
		if(a % i == 0 && b % i == 0){
			gcd *= i;
			a /= i;
			b /= i;
		}
	}
	
	cout << gcd << " " << lcm << endl;
	}
}

C++: include <iostream>
int GCD(int a, int b) {
 while (b!=0) {
  int r = a%b;
  a = b;
  b = r;
 }
 return a;
}
int main() {
 int a,b;
 while (std::cin>>a>>b) {
  int gcd = GCD(a,b);
  int lcm = a*b/gcd;
  std::cout << gcd << ' ' << lcm << std::endl;
 }
 return 0;
}

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

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

C++: //"push hoge"と言われたらhogeを最後に入れ、"pop"と言われたら最後尾を取りだす。"quit"で終わり。
#include<iostream>
using namespace std;

int main(){
	int a,b,hoge = 0,j=0;
	int gcd,gcds,lcm,lcms;

	while(cin >> a >> b){
		//最大公約数
		if(a > b){
			lcm = b;
			lcms = a;
		}else{
			lcm = a;
			lcms = b;
		}
		for(int i=1;i<=lcm;i++)
			if(!(lcms % (lcm / i)) && !(lcm % i)) {
				lcm = lcm / i;
				break;
			}
	
		j = 0;
		//最小公倍数
		if(a > b){
			gcd = a;
			gcds = b;
		}else{
			gcd = b;
			gcds = a;
		}
		while(1){
			j++;
			hoge = gcd * j;
			if(!(hoge % gcds)){
				gcd = hoge;
				break;
			}
		}

		cout << lcm << " " << gcd << endl;
	}
	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 main(){
  while(true){
    int a,b;
    cin >> a >> b;

    if(cin.eof())
    break;

    int g=gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }

  return 0;
}

C++: #include<iostream>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int x,y;
while(std::cin>>x>>y)std::cout<<g(x,y)<<' '<<x*y/g(x,y)<<'\n';
}

C++: #include<iostream>
using namespace std;
int main(void){
    long a, b;
    while(cin >> a >> b){
        long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm,status,temp;
	while(1){
		status=scanf("%d%d",&a,&b);
		
		if (status==EOF) break;
		
		if (a>b){
			temp=b;
			b=a;
			a=temp;
		}
		
		gcd=a;
		
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=b/gcd*a;
		
		if (lcm==0){
			if (a*b==gcd)lcm=1;
		}

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(2=scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);return 0;}