Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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>
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){
    if(a < b)swap(a,b);
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
  }
  return 0;
}

C++: //最小公倍数と最大公約数を求める
#include<iostream>
#include<cstdio>
#include<algorithm>
unsigned long a,b;//aとbの最小公倍数と最大公約数を求める
unsigned long G,L;//最大公約数と最小公倍数
int GCD(int x,int y){
  int c;
  c = x%y;
  if(c ==0)
    return y;
  else{
    return (GCD(y,c));
 }
}

int main(){
  while(scanf("%lu %lu",&a,&b) != EOF){
    if(a >b)
     G = GCD(a,b);
    else if(a <b)
      G = GCD(b,a);
    else
      G = a;
    
    L = (a*b)/G;
  printf("%lu %lu\n",G,L);

  }
  return 0;
}

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

int main(){
    double a,b;

    while(cin>>a>>b){
        cout<<__gcd(a,b)<<" "<<a / __gcd(a,b) * b <<endl;
    }
    return 0;
}

C++: #include <cstdio>

int main()
{
    long a, b;
    long m, n, temp;

    while (scanf("%ld %ld", &a, &b) != EOF) {
        if (a < b) {
            temp = a;
            b = a;
            a = temp;
        }
        m = a;
        n = b;

        while (n != 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%ld %ld\n", m, a / m * b);
    }

    return 0;
}

C++: 













































File Edit Options Buffers Tools C++ Help
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
        T c;
        while (a != 0) {
                c = a; a = b%a;  b = c;
        }
        return b;
}

template<typename T>
T lcm(T m, T n)
{
        return ((m / gcd(m, n)) * n);
}

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

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

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

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

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

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

C++: #include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
LL gcd(LL a,LL b)
{
    return b == 0 ? a : gcd(b,a % b);
}
int main()
{
    LL a,b;
    while(scanf("%lld%lld",&a,&b) == 2)
    {
        if(b > a)
            swap(a,b);
        LL res = gcd(a,b);
        printf("%lld %lld\n",res,a * b / res);
    }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int a[2];
int main(){
	while(cin>>a[0]>>a[1]){
		sort(a,a+2);
		for(int i=a[0];;i--){
			if(a[0]%i==0&&a[1]%i==0){
				cout<<i<<" ";
				goto loop;
			}
		}
		loop:;
		for(int i=a[1];;i++){
			if(i%a[0]==0&&i%a[1]==0){
				cout<<i<<endl;
				goto age;
			}
		}
		age:;
	}
	return 0;
}

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

long long GCD(long long a,long long b){
    if(b!=0){
        GCD(b,a%b);
    }
    else{
        return a;
    }

}

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

    while(scanf("%lld %lld",&a,&b)!=EOF){
        if(a==0 || b==0){
            printf("0 0\n");
            continue;
        }
        else if(a<b){
            x=a;
            a=b;
            b=x;
        }
        x=GCD(a,b);
        printf("%lld %lld\n",x,(a/x)*b);

    }
}

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

typedef long long lli;

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

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

int main() {
  lli a, b;
  while(cin >> a >> b) {
    cout << gcd(a,b) << " " << lcm(a,b) << endl;
  }
  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 == b)
		{
			g = a;
			break;
		}
		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;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

C++: #include <algorithm>
#include <iostream>
using namespace std;
 
int main() 
{
  int a, b,c;
  while (cin >> a >> b) 
  {
   a=c;
   if(b!=0)
   {
    c=b;
    b=a%b;
    }
    cout << c << " " << a * b / c << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
ll a, b;
ll gcd(ll a, ll b)
{
	if(b == 0) return a;
	return gcd(b, a%b);
}
int main()
{
	while(cin >> a >> b)
		cout << gcd(a, b) << " " << a/gcd(a, b)*b << endl;
	return 0;
}

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

long gcd(int m, int n) {
    if((0 == m) || (0 == n)) return 0;
    while(m != n) {
        if(m > n) m = m - n;
        else n = n - m;
    }
    return m;
}

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

int main() {
    vector<int> v1;
    vector<int> v2;
    while(cin) {
        int a, b;
        cin >> a >> b;
        v1.push_back(a);
        v2.push_back(b);
    }
    for(int i=0; i<v1.size();i++) {
        cout << gcd(v1[i], v2[i]) << " " << lcm(v1[i], v2[i]) << endl;
    }
    return 0;
}

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);
    }
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>
int main(){
   int a, b, r, lcm, x, y;
    while (scanf("%d %d",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%d %d\n",y,lcm);
    }
    return 0;
}